Branches and rebase
Merging and rebasing answer different questions about history. These guides explain what each operation keeps, what it rewrites, and how to tidy local commits before anyone else sees them.
Git interactive rebase: organize commits before sharing them
Learn how a Git interactive rebase works: reword, squash and reorder local commits, handle conflicts, and check the result before you push.
Undo a git rebase mistake: reflog, reset or revert
Undo a git rebase: find the old branch tip in git reflog, reset your commits to it, or revert the changes if the rebase was already pushed.
Git undo merge: undoing a merge with reset or revert
Git undo merge in three cases: abort a merge in progress, reset your branch if the merge is local, or revert a pushed merge commit with git revert -m 1.
Git merge vs rebase: choosing for your history and team workflow
Git merge vs rebase on the same diverged branch: compare both graphs, fast-forward and merge commits, then pick the right one for your team.
Git reorder commits with an interactive rebase
Git reorder commits with an interactive rebase: swap independent commits, see why dependent ones conflict, and check the final tree and graph.
Git squash commits: combine local commits into one
Git squash commits with an interactive rebase: combine local commits into one, pick the final message and check that the files did not change.