How do make git ignore files in the git repository?



  • git man page: http://bit.ly/2nvGNWB

    To do this you need to create .gitignore file in the root of the git repository.

    I want ignore files superduper.aux superduper.log superduper.pdf

    $ ls
    superduper.aux  superduper.log  superduper.pdf
    

    A git status show my files untracked, I want git to ignore these.

    $ git status
    On branch master
    Untracked files:
      (use "git add <file>..." to include in what will be committed)
    
    	superduper.aux
    	superduper.log
    	superduper.pdf
    
    nothing added to commit but untracked files present (use "git add" to track)
    

    Add file patterns or file names to this file, then do another git status

    $ vi .gitignore
    
    $ git status
    On branch master
    Untracked files:
      (use "git add <file>..." to include in what will be committed)
    
    	.gitignore
    
    nothing added to commit but untracked files present (use "git add" to track)
    

    We want to add the .gitignore and commit it.

    $ git add .
    $ git commit -m "Add my gitignore file"
    [master 1f9cde2] Add my gitignore file
     1 file changed, 3 insertions(+)
     create mode 100644 .gitignore
    $ git status
    On branch master
    nothing to commit, working directory clean
    

Log in to reply
 

© Lightnetics 2024