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.](/static/2fbd9d1dbbc7fef578b1b2643c041d38/5a190/01.png)
![Identify the commit you want to rewrite and run the git rebase -i command. Diagram of identifying a commit to rewrite.](/static/ba970d65f4ff3e3ee522f8bac63fcfee/5a190/02.png)