Search code examples
gitgithubgitignore

.gitignore only on local


I would like to know how to gitignore files but only on local, without pushing it (because the other people working on the project should not get this update of gitignore of files I added there.

To be simple, after a git status I only have :

modified:   .gitignore

because I added my files to ignore to my gitignore but well now I want the line above gone without pushing it.


Solution

  • For local ignores you should use the .git/info/exclude file, not .gitignore:

    Patterns which are specific to a particular repository but which do not need to be shared with other related repositories (e.g., auxiliary files that live inside the repository but are specific to one user’s workflow) should go into the $GIT_DIR/info/exclude file.

    The two files accept the same format.