Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resolve rebase conflicts easily

Tags:

git

git-rebase

When I execute: git pull --rebase from my feature branch, I get conflicts in lot of files which I've never edited. To get rid of these conflicts I execute following set of commands for each and every conflicted files.

git checkout --ours .

git add .

git rebase --continue

The annoying part is I have to execute this for every conflicts. Is there any way to configure git with a custom command so that above all commands will execute at once.

Something like:

If(featureBranch_04) {
   foreach(conflicts)
      if(conflictedFile != index.jsp) {
          git checkout --ours .
          git add .
          git rebase --continue
      }
   }
}

Can I have a similar function in git config ?

The workflow is: First I merged the master branch into featureBranch_04, and then git pull --rebase from the featureBranch_04 branch.

like image 539
giri_col Avatar asked Dec 03 '25 11:12

giri_col


1 Answers

You could try a:

git fetch
git rebase -s recursive -X theirs origin/featureBranch_04

That would pass the merge strategy 'theirs' to the merge part of a rebase.

like image 127
VonC Avatar answered Dec 05 '25 01:12

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!