added gitrebase guide
authorPatrik Gornicz <Gornicz.P@gmail.com>
Sat, 20 Jun 2009 18:01:46 +0000 (14:01 -0400)
committerPatrik Gornicz <Gornicz.P@gmail.com>
Sat, 20 Jun 2009 18:01:46 +0000 (14:01 -0400)
gitrebase.txt [new file with mode: 0644]

diff --git a/gitrebase.txt b/gitrebase.txt
new file mode 100644 (file)
index 0000000..6ed9b4a
--- /dev/null
@@ -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