I am setting up my first project in Git. How do I setup git-ignore
file in Windows?
I am creating my first Rails project using Vagrant and trying to configure .gitignore
in Windows
Use your favorite text editor to open the file called . git/info/exclude within the root of your Git repository. Any rule you add here will not be checked in, and will only ignore files for your local repository.
If you want to maintain a folder and not the files inside it, just put a ". gitignore" file in the folder with "*" as the content. This file will make Git ignore all content from the repository.
Also, the default and automatic global gitignore file is $HOME/. config/git/ignore .
It seems that for ignoring files and directories there are two main ways:
Placing .gitignore
file into the root of your repo besides .git
folder (in Windows make sure you see the true file extension and then
make .gitignore
.
Making global configuration %HOMEPATH%\.gitignore_global
and running
git config --global core.excludesfile %HOMEPATH%\.gitignore_global
to add this to your git config.
Note: files tracked before can be untracked by running git rm --cached filename
. This absolutely critical for repos that existed BEFORE you created the .gitignore
For local files that doesn't need to be shared, you just add file pattern or directory to file .git\info\exclude
. These rules are not committed, so are not seen by other collaborators in your project. These are machine specific configs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With