3

I'm quite new to git and have following problem:

I've worked on a some large code file in my private branch and refactored it so most of it was moved to few other code files. Now I'm trying to merge back to master via "git merge --squash --no-commit mybranch" but then I'm trying to commit it gives me an error:

error: 'foo' has changes staged in the index (use --cached to keep the file, or -f to force removal)

And the status of foo is "modified" and "renamed to bar" while bar is new file which is used from foo. How do I tell git this isn't rename and commit?

4

1 回答 1

3

Change the rename threshold on the merge to 100% (or something really high):

git merge -X rename-threshold=100 <branch>

git merge will then only detect renames, for this particular merge, if the two files are 100% identical. It's a one-off, merge strategy argument so you needn't worry about it being a permanent setting.

于 2012-08-17T21:08:08.980 回答