There's more...

It's also possible to ignore files of a repository without the .gitignore files. You can put your ignored files in a global ignore file, for example ~/.gitignore_global, and globally configure Git to also consider entries in this file to be ignored:

$ git config --global core.excludesfile ~/.gitignore_global

You can also do it per repository in the .git/info/exclude file. If you use either of these options, you won't be able to easily share the ignored file; they can't be added to the repository as they are stored outside it. Sharing .gitignore files is much easier; you just add and commit them to Git. But, let's see how the other options work:

$ echo "*.test" > .git/info/exclude
$ touch test.test
$ git status
On branch ignore
  Your branch is ahead of 'origin/ignore' by 1 commit.
    (use "git push" to publish your local commits)
    
  Untracked files:
    (use "git add <file>..." to include in what will be committed)
    
      test.txt
    
nothing added to commit but untracked files present (use "git add" to track)
$ ls
bar        bin       foo
test.test  test.txt  test.txt.bak

We can see that the .test file didn't show up in the status output and that the ignored files exist in the working directory.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.211.66