Remember that if you already published E or later, write to master on remote, then DO NOT rebase on them, as this will break other code, and you will also have to manually fix your repositories.
Rebase creates new versions, it cannot magically modify existing ones (therefore, it uses SHA1, so you are sure that your commit contains what generated this SHA1 and does not change)
But if you are ready for this, go on to my example.
- First you need to go back to commit right before merging the library, create a named branch there, say 'lib-squash'
git merge --squash library ; git commitgit checkout mastergit rebase -i -p --onto lib-squash <sha1 old merge commit>- optional
git branch -D library and git branch -d lib-squash
This leaves you with a clean history, but you just rewrote the history, you need to click with the -force flag, and then each person will have to fix their repository:
git fetchgit checkout mastergit reset --hard origin/master , assuming you have no other local commits than in the remote repository- If you have any local commits, you also need to βresetβ these commits.
Unfortunately, I did not find an article about canceling historical commits without affecting future commits.
source share