4

I am trying to get my master changes into my local branch by doing

git checkout MyPersonalBranch git rebase master 

then I get the error

 Patch failed at ..blah blah When you have resolved this problem, run "git rebase --continue". If you prefer to skip this patch, run "git rebase --skip" instead. To check out the original branch and stop rebasing, run "git rebase --abort". 

When I try git rebase --continue I get the error

xxx.client.jar: needs merge You must edit all merge conflicts and then mark them as resolved using git add 

I want it to keep the xxx.jar in MyPersonalBranch. How do I tell git not to try to merge this one file?

4
  • What do you mean by "keep the xx.jar" and not merge it? Also rebase isn't a merge. It's a replay of the changes Commented Jun 3, 2014 at 19:11
  • I want to replace the original jar with my jar. I don't want it to compare the binary's contents. Commented Jun 3, 2014 at 19:12
  • Again, there is no merge occuring, its rewinding your commits and then replaying them after fast-forwarding HEAD. Exactly how you do that is going to vary based upon your sequence of commits, how many times you edit the jar etc. I strongly suggest you go read the GIT book git-scm.com/book to understand what you are doing. Commented Jun 3, 2014 at 19:14
  • 1
    You probably shouldn't be tracking Java .jar files in git. There's not a particularly useful way to difference them, patch them, compare them, merge disparate changes to them, etc... Commented Jun 3, 2014 at 19:51

2 Answers 2

4

In general, you can use the --strategy option to specify how conflicts should be handled. The strategy theirs blindly replaces files.

However, in your case, you've only got a single file. You really won't want to use the theirs strategy for all files. Instead, after you get the message to resolve the conflict, you can checkout that one specific file from the branch:

git checkout <branch> yourfile 

(At that point, <branch> still refers to the branch as it was before the rebase started.)

Sign up to request clarification or add additional context in comments.

1 Comment

I get error: path myfile is unmerged so in my case <branch> seems to be HEAD
-2

Make sure the file contents are correct, then git add it and continue the rebase.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.