Skip to main content
  1. Learn
  2. Software Development
  3. Guides
  4. Git tutorial
  5. Git basics
  6. Managing Git history
  7. Copying commits to new branches
GuidesSoftware DevelopmentBacklog
Git

Project and code management together.

Copying commits to new branches

Rebasing is the process of taking all changes committed on one branch and copying them to a new branch.

Run the git rebase command and add the -i option to rewrite, replace, delete, and merge individual commits in the history.

You can also use the rebase command to:

  • Rewrite a past commit message
  • Squash a group of commits together
  • Add files that have not been committed
Diagram of reabsing.
Diagram of identifying a commit to rewrite.
Identify the commit you want to rewrite and run the git rebase -i command.

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life