Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

resolve git conflict with plumbing commands

Tags:

git

I am trying to script some git operations which involves some rebasing/cherry-picking/etc.

Is there a way to resolve a conflict without having to run commands such as:

git rebase --continue
git cherry-pick --continue
git merge --continue

I am trying to avoid the editor ever being executed when git wants a commit message.

Perhaps there is a way to tell git that things have been resolved and pass in a default commit message if needed?

like image 461
Jonathan.Brink Avatar asked Apr 12 '15 14:04

Jonathan.Brink


2 Answers

You can use git commit -m '$msg' to commit the changes, then issue a command saying "keep going with the next steps" :

For git rebase :

git commit -m '$msg'
git rebase --skip

For git cherry_pick :

git commit -m '$msg'
# if you are cherry-picking several commits at once,
# this will skip the current (conflicting) one, and proceed with the remaining ones :
git reset
git cherry-pick --continue

For git merge :
There is no git merge --continue directive. In case of conflict you just fix the conflict, then commit. So git commit -m '$msg' will do it.

like image 200
LeGEC Avatar answered Oct 21 '22 13:10

LeGEC


Try to use -x option. Thats options does:

-x When recording the commit, append a line that says "(cherry picked from commit ...)" to the original commit message in order to indicate which commit this change was cherry-picked from. This is done only for cherry picks without conflicts. Do not use this option if you are cherry-picking from your private branch because the information is useless to the recipient. If on the other hand you are cherry-picking between two publicly visible branches (e.g. backporting a fix to a maintenance branch for an older release from a development branch), adding this information can be useful.

git-scm.herokuapp.com/docs/git-cherry-pick

Also --allow-empty may be usefull

like image 24
Roman Makhlin Avatar answered Oct 21 '22 14:10

Roman Makhlin