-
Notifications
You must be signed in to change notification settings - Fork 1
/
xbgb.txt
36 lines (36 loc) · 1.93 KB
/
xbgb.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Rebasing
To review,
rebasing is an alternative to merging
that takes all the changes you’ve done since you branched off
and applies those changes as patches to where the branch you are rebasing to is now,
abandoning your original commit objects.
For clean merges,
this is a relatively simple process.
Say we have been working in a branch called ‘story84’
and it’s completed and we want to merge it into the master branch.
If we do a simple merge, our history will look like this:
But we don’t want to mess up our history with a bunch of branches and merges when it can be clearer.
Instead of running ‘git merge story84’ from the master branch,
we can stay in the ‘story84’ branch and run ‘git rebase master’
Many times this goes very smoothly and you can see all the new commits and trees written in place of the old ones.
In this case, I had edited the ‘lib/simplegit.rb’ file differently in each branch which caused a conflict.
I will have to resolve this conflict before I can continue the rebase.
This gives us some options,
since the rebase can do this at any point
– say you have 8 commits to move onto the new branch
– each one could cause a conflict and you will have to resolve them each manually.
The ‘rebase’ command will stop at each patch
if it needs to and let you do this.
You have three things you can do here,
you can either fix the file,
run a ‘git add’ on it and then run a ‘git rebase—continue’,
which will move on to the next patch until it’s done.
Our second option is to run ‘git rebase—abort’,
which will reset us to what our repo looked like before we tried the rebase.
Or, we can run ‘git rebase—skip’,
which will leave this one patch out,
abandoning the change forever.
Git rebase options for a conflict:
—continue : trys to keep going once you’ve resolved it,
—abort : gives up altogether and returns to the state before the rebase,
—skip : skips this patch, abandoning it forever