Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to ignore specific files in git ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 619
    Comment on it

    Git is a version control system which keeps the track of changes made in the source code. There are many times, we do not want to upload the credentials file on git because those will be visible to all the stakeholders. Also, there are many files that are related to local environment and changes made in that file will not make effect on the source code of our project. So, we do not upload that file to git. Let's suppose if a team is working on a project and before every release a test suite is run to confirm that the build is in stable state. In few testcases, there is a functionality to capture the screenshot. The name of all the screenshots is prefixed with “screenshot” keyword, so that the other images can easily be identified.

    There is no use to track these screenshots, so git provides a facility to ignore some files that we do not want to track. In order to achieve this, we create a “.gitignore” file in the root of our place the files that we want to ignore.

     

    Writing the individual filename is not a good technique to ignore files. So, we give some pattern to ignore the files to be tracked. If we do not track the screenshot files then we have to give the following in .gitignore file.

     

    [screenshot]*.*

     

    This pattern will only allow git to track those files that do not start with the word “screenshot”

     

    [0-9]*.feature

     

    This pattern will ignore those feature files that starts with a number.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: