If you need to squash your commits into fewer ones, do the following:
# go on the base branch you want to make the rebase against git checkout base_branch # grab all changes from remote server git pull --rebase -v # go on your working branch git checkout my_branch # run rebase with interactive mode git rebase -i base_branch
At this point, you'll get a prompt with a list of commits like this:
pick 111111 commit message 1 pick 222222 commit message 2 pick 333333 commit message 3
You will have to replace
squash for the commits you want to merge with the previous one.
Attention! Don't make those changes to the first commit.
If you will have conflicts, you'll have to fix them and then run
git rebase --continue
Or have a better look on the messages from the screen and do what is indicated there according to your situation.
If everything went good, then the last step is to force push the changes to your own branch
# force push the changes to the branch git push -f origin my_branch