Is there some cleaner way to make Git just ignore some of my changes and never commit them? .gitattributes:
config_to_be_deviated.xml filter=qqq
.git/config:
[filter "qqq"] clean = "perl -ne 'print unless /git_please_dont_look_here/'" smudge = (Q=$(mktemp) && cat > $Q && patch -s $Q < /tmp/pp && cat $Q && rm $Q)
The patch /tmp/pp adds my changes with "git_please_dont_look_here" in each line.
Git removes all such lines before getting the file into repository and readds my changes when checking out it; I can continue adding and committing useful changes to config_to_be_deviated.xml
, but changes in the patch will not be seen by Git.
It looks like this "filter" approach is the best suited for me.
Pros:
Cons:
Put them into separate file, ignore the file in git and hook it up to your build so it gets included?
try
git update-index --assume-unchanged --<path>
. It acts like gitignore for files under source control. The original purpose of the feature though, was to improve performance of git checking modifications in a folder with lots of files. Here is the doco:I am not all to familiar with git. With Mercurial I use a patch queue (MQ) or the shelve (similar to git stash) for such things.
git stash
can be convenient to use, if you're "localizable" information is easy to locate (e.g. all in a single config file).Using a patch queue is a little more complex but once setup correctly superior because you can manage localizable information in a transparent push/pop manner. You can find a list of patch queues on top of git here on SO.
Now the default config is tracked, and your customizations of the default config are not.