Changes between Version 1 and Version 2 of GitRejectedPatch


Ignore:
Timestamp:
Jul 30, 2013, 12:01:57 PM (11 years ago)
Author:
abeccati
Comment:

cherry-pick cleaning master

Legend:

Unmodified
Added
Removed
Modified
  • GitRejectedPatch

    v1 v2  
    147147----
    148148
    149 Final note: conflicts can always happen, it's not your fault.[[BR]]
     149== 2A. Cherry-pick cleaning local master ==
     150
     151Assuming (use export to set them in bash):
     152{{{
     153  rejcomm=sha-of-your-rejected-commit
     154  lastgood=sha-before-your-rejected-commit
     155}}}
     156
     157{{{
     158#branch from last good commit
     159git checkout -b re-patch $lastgood
     160
     161#cherry-pick rejected patch to be fixed, without committing it
     162git cherry-pick $rejcomm --no-commit
     163
     164#Amend the files, stage them with git add, then commit and create the new patch
     165geany fileToAmend
     166git add fileToAmend
     167git commit -m "old message /vN" #with N=2 to be incremented just in case
     168git format-patch HEAD^ # Works only with single last commit
     169
     170# Now you are left with the rejected patch still committed on the master
     171# and the "hopefully to be accepted" patch in your temporary branch
     172# A practical way to avoid merge conflicts and let you merge your branch
     173# and pull from master is to:
     174
     175# Revert the rejected patch on your master
     176git checkout master
     177git revert $rejcomm
     178
     179#merge your re-patch branch (should go without conflicts, if not see note)
     180git merge re-patch
     181}}}
     182
     183 * NOTE: If you have more than one related commits (depending on) to the reverted patch (perhaps also to be amended), you can cherry pick also these to the branch and revert them in reverse order on the master.
     184 * NOTE2: Still not know what to do if the dependent commits are from other authors (should not happen since the patch was not accepted) but I guess the method still applies as long as you add a patch taking care of such dependent commits.
     185
     186== Final note ==
     187Conflicts can always happen, it's not your fault.[[BR]]
    150188https://duckduckgo.com/?q=git+rebase+conflict