When installing apps locally some files have data which is unique to your install path or domain. For example I installed our app at EasyRx locally and the yaml setting for the domain used for cookies was tracked by git. I changed the value in my local install but then it showed up as a change in git which I definitely don’t want to commit.
There is a temporary option. git update-index --assume-unchanged /path/to/file.yml
Setting --assume-unchanged
to the file will effectively hide those changes.
However, be aware, if you git add
the specific file it will add it to the files staged for commit.
If you just do a blanket git commit -a
it won’t add the file.
Of course you need to remember that it’s set that way!
Another option can be found here: https://stackoverflow.com/posts/16244970/revisions
Here’s a quick example of –assume-unchanged I found here: http://gitready.com/intermediate/2009/02/18/temporarily-ignoring-files.html
Let’s go over a quick example of using the command. Changes have been made to a few files in my working directory:
$ git status
# On branch master
#
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
#
# modified: README.textile
# modified: Rakefile
# modified: TODO
#
no changes added to commit (use "git add" and/or "git commit -a")
If I ran git commit -a from here, all of the files would be added into the new commit. However, I want to temporarily ignore the changes in one of the files:
$ git update-index --assume-unchanged README.textile
$ git status
# On branch master
#
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
#
# modified: Rakefile
# modified: TODO
#
no changes added to commit (use "git add" and/or "git commit -a")
So if we commit the work now then turn the flag off, we can see that Git didn’t lose the original changes to the README. From there, you could now add them into a new commit, or revert back to the latest copy.
$ git update-index --no-assume-unchanged README.textile
$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 4 commits.
#
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
#
# modified: README.textile
#
no changes added to commit (use "git add" and/or "git commit -a")