git merge branch without merge ocmmit 1

git merge branch without merge ocmmit

git checkout master
git checkout -b feature/foo

# make some commits

git rebase master
git checkout master
git merge --ff-only feature/foo

Here is what the above code is Doing:
1. Create a new branch called feature/foo
2. Make some commits
3. Rebase the feature branch against master
4. Merge the feature branch into master

The rebase command is the key here. It will take all the commits in the feature branch and replay them on top of the master branch. This will make the history look like this:

Similar Posts