From 0328019d6385070a3ca0e1f2fd87c7b8bd1e004e Mon Sep 17 00:00:00 2001 From: Patrik Gornicz Date: Sat, 20 Jun 2009 14:01:46 -0400 Subject: [PATCH] added gitrebase guide --- gitrebase.txt | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 gitrebase.txt diff --git a/gitrebase.txt b/gitrebase.txt new file mode 100644 index 0000000..6ed9b4a --- /dev/null +++ b/gitrebase.txt @@ -0,0 +1,75 @@ + +So, you want to push something but you are getting a non-fast forward error. +Here's how to update your local repository so your push will be a fast +forward. + +If you type git status you should see something like this. + +# On branch master +# Your branch and 'origin/master' have diverged, +# and have 2 and 2 different commit(s) each, respectively. +# +nothing to commit (working directory clean) + +This means that the history of the repository looks something like this + + C---D master + / + A---B---E---F origin/master + +Where C and D are two commits you made, and E and F are two commits someone +else made and pushed to the up stream repository. + +There are two ways to fix this. One you could do a merge which results in this + + C---D---- + / \ + A---B---E---F---M master, origin/master + +Where M is a merge commit of master and origin/master, and when you push the +history will literally have this small loop in it. We will _NOT_ be doing this. + +Options two is to do a rebase which results in this + + C'--D' master + / + A---B---E---F origin/master + +Where C' and D' are the same commits as before, with the exception of having to +handle possible collisions. + +This is what we'll be doing. To perform this operation simply type + +> git rebase origin/master master + +or if you are on the branch master, you can simply use + +> git rebase origin/master + +If there are no collisions, your done. Here's some example output. + +First, rewinding head to replay your work on top of it... +Applying: commit C's message +Applying: commit D's message + +If there are collisions, you have to resolve them. Once resolved you + +> git add file +> git rebase --continue + +and it continues rebaseing your changes. If you want to abort the rebase +because the resolve was too nasty you can + +> git rebase --abort + +which will bring you back to + + C---D master + / + A---B---E---F origin/master + +once your done rebaseing you can simply do a git push and it should work out +now. Assuming of course that someone else didn't push more stuff ... + +Enjoy, +Patrik -- 2.10.2