16 | Rewriting History by Rebasing |
Rebasing commits is the one concept in Git that has no counterpart
inside the traditional version control world. Using
git rebase
, you can rewrite the history
of a repository in a variety of ways. It is one of the most
powerful commands in Git, which makes it one of the most dangerous.
rebase
takes a series of commits (normally a branch) and replays
them on top of another commit (normally the last commit in another
branch). The parent commit changes so all the commit IDs are
recalculated. This can cause problems for other developers who
have your code because the IDs donât match up.
Thereâs a simple rule of thumb with git
rebase
: use it as much as you want on local commits. Once youâve shared changes ...
Get Pragmatic Guide to Git now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.