On Nov 19, 2007, at 8:05 PM, Ralf Wildenhues wrote:

If you have your patch at the top of master, do this:

  # ensure master branch is checked out:
  git checkout master
  # create a new branch that is identical:
  git checkout -b my-ternary
  # now, go back to master and reset that to before the patch:
  git checkout master

Can be simplified as: git branch my-ternary master

  git reset HEAD^

Personally I always use git reset HEAD~1 which is equivalent and works nicely with ZSH extended_glob :)

  # get upstream changes; this should be a fast-forward now:
  git pull
  # ensure by inspection that there was no merge commit:
  git log

gitk is better to graphically see the merges.

  # now go back and rebase your change:
  git checkout my-ternary
  git rebase master
  # You may have to fix some conflicts here...

  # When done rebasing, you can pull the ternary change into master
  # and push that:
  git checkout master
  git merge my-ternary

Be careful, if this is not a fast-forward merge, it will introduce an unwanted merge commit in the history. I would rather push the my- ternary branch which I know has just been rebased against master and then do a pull in master. It's safer.

  # inspection:
  git log; git show
  # publish:
  git push

  # finally, you should not need the branch any more:
  git branch -d my-ternary

HTH.  Untested.

:)

--
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory


Attachment: PGP.sig
Description: This is a digitally signed message part

Reply via email to