Reputation: 10228
I've used $ git pull origin master
(which is a combination of fetch
and merge
) and $ git push origin master
so far. Now I'm hearing about rebase
. I've read the documentation about it but sadly I couldn't understand how it works exactly.
One: What does '
(which is in the top of D
and E
) mean?
before rebase:
A <- B <- C
^ ^
\ \
D <- E <- F
after git rebase master:
A <- B <- C <- D' <- E'
two: When should not I use $ git rebase
? (also is it the same as git pull --rebase
?)
Upvotes: 2
Views: 486
Reputation: 7057
One: What does
'
(which is in the top ofD
andE
) mean?
The '
mean that the commits D'
and E'
have been altered from the original D
and E
by git's rebase functionality. So although they may end up with equivalent code changes (unless there are conflicts), they are not literally the same commits, precisely because they will at least have different history from D
and E
. In git, commits with different history are different by design, and they will have different hashes.
two: When should not I use
$ git rebase
? (also is it the same asgit pull --rebase
?)
When the result will be pushed to a branch that is already a shared remote, "shared" here meaning essentially that others have checked it out and have made at least local changes to it (or you are not sure whether others have done so).
From the git docs:
Rebasing (or any other form of rewriting) a branch that others have based work on is a bad idea: anyone downstream of it is forced to manually fix their history.
Upvotes: 4