Git Gitignore

jasonlarkin edited this page Aug 20, 2012 · 5 revisions

Gitignore

Gitignore is a useful tool to let git know to ignore certain files or patterns of files. Simply go into your repo folder (e.g. ~/ntpl) and create .gitignore. Add any files you don't want in plain text on a new line to let git know you want to ignore them, e.g.:

test.txt
out.*
in.*

Global gitignore

Gitignore can also be used on a global scale, and this is how the ntpl repo is kept clean. First, in your home directory (~) create a file .gitignore_global. Then add the following three lines to it:

in.*
out.*
tmp.*
*.pyc

Any files that match this pattern won't be recognized by git and therefore will not be uploaded to the repo (and will make your "git status" command a lot cleaner). Next, run this command: "git config --global core.excludesfile ~/.gitignore_global". This will add the file to your config. And you're done! Remember, you can still create custom .gitignore files in any of your subdirectories. To learn more about the issue see this page.


##ignore any directory with given name

http://stackoverflow.com/questions/1470572/gitignore-ignore-any-bin-directory

##cleaning your ./.git folder

http://stackoverflow.com/questions/5277467/how-can-i-clean-my-git-folder-cleaned-up-my-project-directory-but-git-is-sti

http://stackoverflow.com/questions/2116778/reduce-git-repository-size/2116892#2116892

http://stackoverflow.com/questions/359424/detach-subdirectory-into-separate-git-repository/1591174#1591174

http://stackoverflow.com/questions/3797907/howto-remove-unused-objects-from-a-git-repsitory

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.