I like to commit locally at every opportunity – ending up with all sorts of comment spam in my git repository. Changes may get reverted multiple times, never mind that late night commits contain interesting expletives. Is there an easy way to filter my git push to a public repository to remove all of the comment spam?
Ideally, I would like each push to the public repository to collapse all of the changes in my branch into one batch, and have one, clean, comment attached to it. Is this something I can do with git, and if so, how?
git rebase –interactive will let you squash, edit, split and delete commits, it’s a very powerful command (risky too). Since
git rebaseis a history rewriting command, beware of using it on branches that were either push/pulled.Keep in mind though that it’s considered good practice to split your changes over several commits, rather than one gigantic commit.