Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 1.52 KB

07-rebase.md

File metadata and controls

46 lines (33 loc) · 1.52 KB

Rewriting history

Goal

Get some in-depth knowledge of git rebase command.

Intro

Rebase is one of two Git utilities that specializes in integrating changes from one branch onto another. The other change integration utility is git merge. Merge is always a forward moving change record. Alternatively, rebase has powerful history rewriting features.

Rebasing is the process of moving or combining a sequence of commits to a new base commit. Rebasing is most useful and easily visualized in the context of a feature branching workflow.

From a content perspective, rebasing is changing the base of your branch from one commit to another making it appear as if you'd created your branch from a different commit. Internally, Git accomplishes this by creating new commits and applying them to the specified base. It's very important to understand that even though the branch looks the same, it's composed of entirely new commits.

Tasks

  • Change last commit message
  • Squash last two commits
  • Change commit message on the third commit from the top

Solution

  • git commit --amend
  • git rebase -i HEAD~n where n is number of commits on which the operation is going to be performed

Read more