I have a regular master branch, and a topic branch, which has master as an ancestor.
master has gone one direction, and topic has gone another direction.
master looks like this:
savePerson: function(e) {
e.preventDefault();
var spinner = new Spinner({
spinner:this.el,
stopEvent:{context:this.model,event:'save'}
});
this.model.save();
}
and topic looks like this:
savePerson: function(e) {
e.preventDefault();
if (!this.validator.valid()) {
return;
}
this.model.save();
}
Doing a diff I get:
savePerson: function(e) {
e.preventDefault();
- var spinner = new Spinner({
- spinner:this.el,
- stopEvent:{context:this.model,event:'save'}
- });
+
+ if (!this.validator.valid()) {
+ return;
+ }
+
Now as a human, its clear to me, which piece of code goes where, and I am understanding that git is clearly confused, and thus raises a conflict.
Is there a way I can fix up the topic file, so that there won’t be a conflict?
You can only fast forward on linear successions. Even if you had identical branches you would have to merge (if they aren’t in linear succession).
Now what you can do, is to prevent the merge completely by rebasing the topic branch on top of master and then merging, or cherry picking the commits onto master.