# [[Git Merge vs Git Rebase]]
*Git Merge* combines all "ahead" commits from another branch, and commits them as a single "merge commit" in the current branch. This is used mainly for merging new features into the main branch. A merge commit maintains all information of the original commits.
```bash
git checkout main
git merge awesome-new-feature
```
*Git Rebase* moves the entire current branch to another point in the tree. It takes the "ahead" commits of the current branch, and rebases them on top of some other point in the tree, making the current branch now start from that point. See [[The Ultimate Guide to Git Merge and Git Rebase (Web)#Git Rebase example|this example]]. This is useful for making a feature branch up-to-date with `main` again.
```bash
git checkout awesome-new-feature
git rebase main
```
---
Sowed on:: [[2022-10-20]]
Continuation::
Branches::
Sources:: [[The Ultimate Guide to Git Merge and Git Rebase (Web)]]
See also::
#type/zk/zettel #a/mark/personal