## Merge with rebase
First make sure to be on your branch and print commit history
```sh
git checkout your-branch
git log
```
Identify the commint **before** the commit you want use as rebase starting point and copy its hash.
For example, let's say that we want to squash all commits starting from `Add point layers to pixidis`, than we need the hash of `Merge branch 'pixidis-octomap-layer'`.
```text
commit 49a85b1687c058ab21e2e3dd56d52e6f5198aaa2
Author: Pasquale Antonante <p.antonante@gmail.com>
Date: Fri Apr 20 17:45:35 2018 -0700
Add point layers to pixidis
commit cd601f9a211a7eed4ede390fddd2e7a8ba7e3c40
Merge: 4f92e82 fc9d514
Author: Pasquale Antonante <p.antonante@gmail.com>
Date: Fri Apr 20 14:22:44 2018 -0700
Merge branch 'pixidis-octomap-layer'
```
Once you have the hash, run
```sh
git rebase -i cd601f9a211a7eed4ede390fddd2e7a8ba7e3c40
```
Now you favorite editor pops up, mark all old commits with `f` (removing `pick`), and `r` the first one (the oldest in other words). This will say to git to ask for a new commit comment.
This is telling to git to apply the first commit (asking for a new message) and then apply all successive comit shquasing them.
At the end of the process you updated your local git, now you have to update the remote branch,
```sh
git push -f
```
Now you are ready to merge on your local git
```sh
git checkout master
git pull
git checkout your-branch
git rebase master
```
Now comes the hard part....resolve all conflicts...then run
```sh
git rebase --continue
git push -f
```
Now you can use the git web page to complete the merging process. Please, remove your branch after merging.
**Done!**
---
**Note**: never rebase master, it would make all other branches out of sync.