# Difference between `git merge` and `git rebase` Let's assume our project is like this. ![](https://i.imgur.com/PzBx4DK.png) There are a `main` branch and a `feature/i18n` branch. `feature/i18n` was created from `main` branch two days ago. When we are working on `feature/i18n`, someone added two commits to `main` branch. The figure is what it looks like right now. --- ## git merge We want to merge `feature/i18n` into `main`. First of all, we switch to `main` branch. ```shell some-branch# git checkout main ``` Secondly, we use `git merge` command. ```shell main# git merge feature/i18n ``` And then it would be like this. ![](https://i.imgur.com/gLCsifu.png) --- ## git rebase We want to rebase `feature/i18n` onto `main` branch. First of all, we switch to `feature/i18n` branch. ```shell some-branch# git checkout feature/i18n ``` Secondly, we use `git rebase` command. ```shell feature/i18n# git rebase main ``` Then the graph would be the following. ![](https://i.imgur.com/GFtSGwu.png) --- ###### tags: `git`