dontexist
dontexist

Reputation: 5652

Is there a way to ignore an exact change with Git?

I am working with an application where I need to change a string to point to a local URL rather than the production URL. Occasionally, I forget the change and run git commit --all, which makes for a kind of cluttered git history.

Is there a way to exclude a certain change from all git adds? I am aware of git update-index --assume-unchanged, but since work is being done in the same file as the string, this wouldn't work.

Would my best option be to move the string out to some sort of "variables" or "environment" file and run the aforementioned command on it?

Thank you!

Upvotes: 0

Views: 31

Answers (1)

eckes
eckes

Reputation: 67057

Use filters here as described in this answer: https://stackoverflow.com/a/22954399/520162

You'd set up a clean filter that throws away your single change.

I'm changing paths in VisualStudio files in order to build on a ramdisk while the checked in files should build on a path relative to the sources.

Upvotes: 1

Related Questions