created function include varibles F_
[libbear.git] / gitrebase.txt
CommitLineData
0328019d
PG
1
2So, you want to push something but you are getting a non-fast forward error.
3Here's how to update your local repository so your push will be a fast
4forward.
5
6If you type git status you should see something like this.
7
8# On branch master
9# Your branch and 'origin/master' have diverged,
10# and have 2 and 2 different commit(s) each, respectively.
11#
12nothing to commit (working directory clean)
13
14This means that the history of the repository looks something like this
15
16 C---D master
17 /
18 A---B---E---F origin/master
19
20Where C and D are two commits you made, and E and F are two commits someone
21else made and pushed to the up stream repository.
22
23There are two ways to fix this. One you could do a merge which results in this
24
25 C---D----
26 / \
27 A---B---E---F---M master, origin/master
28
29Where M is a merge commit of master and origin/master, and when you push the
30history will literally have this small loop in it. We will _NOT_ be doing this.
31
32Options two is to do a rebase which results in this
33
34 C'--D' master
35 /
36 A---B---E---F origin/master
37
38Where C' and D' are the same commits as before, with the exception of having to
39handle possible collisions.
40
41This is what we'll be doing. To perform this operation simply type
42
43> git rebase origin/master master
44
45or if you are on the branch master, you can simply use
46
47> git rebase origin/master
48
49If there are no collisions, your done. Here's some example output.
50
51First, rewinding head to replay your work on top of it...
52Applying: commit C's message
53Applying: commit D's message
54
55If there are collisions, you have to resolve them. Once resolved you
56
57> git add file
58> git rebase --continue
59
60and it continues rebaseing your changes. If you want to abort the rebase
61because the resolve was too nasty you can
62
63> git rebase --abort
64
65which will bring you back to
66
67 C---D master
68 /
69 A---B---E---F origin/master
70
71once your done rebaseing you can simply do a git push and it should work out
72now. Assuming of course that someone else didn't push more stuff ...
73
74Enjoy,
75Patrik