Viacheslav Kondratiuk Viacheslav Kondratiuk - 6 months ago 39
Git Question

Git: How to rebase and squash commits from branch to master?

I'm trying to rebase and squash all my commits from current branch to master. Here is what I'm trying to do:

git checkout -b new-feature

make a couple of commits, after it I was trying:

git rebase -i master

in this case commits will remain in

git checkout master
git rebase -i new-feauture

It gives me and edit window with noop message.

I know about command:

git merge --squash new-feature

But I'm currently working on learning of


When rebasing, Git will not move commits to another branch. It will move the branch including all its commits. If you want to get the commits into master after rebasing on top of it, use git merge <branch tip or commit of branch> to fast-forward the master branch to that commit.