Don't want to change .gitignore because other people want the files in the repo. But I have my own copy that I want to use.
I edited .git/info/exclude
and added the following:
/Gemfile
/Gemfile.lock
/config/database.yml
/spec/spec_helper.rb
This doesn't seem to do anything. git status
still shows:
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: Gemfile
# modified: Gemfile.lock
# modified: config/database.yml
# modified: spec/spec_helper.rb
What is the best way to keep my local versions of files without using .gitignore?
You could probably call git update-index --assume-unchanged [file names]
or if there are a bunch of files, just do it to .gitignore and modify the ignore file as much as you'd like.
From documentation (emphasis mine):
When the "assume unchanged" bit is on, git stops checking the working tree files for possible modifications, so you need to manually unset the bit to tell git when you change the working tree file. ...
This option can be also used as a coarse file-level mechanism to ignore uncommitted changes in tracked files (akin to what .gitignore does for untracked files).
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