Answers
Here are the answers to the questions given above:
- You can use
git commit --fixupwhen creating a bugfix, and then latergit rebase --interactive --autosquashbefore publishing the series. - You should not rewrite published history because other developers can do their work based on the version before the changes, and then merging would bring older versions (from before the rewrite) back into existence.
- Rebase your own changes on top of the new, rebased version of the upstream.
- If the problem is in the most recent commit, you can amend it with
git commit --amend. If you need to rewrite the whole history of the project, you can use thegit filter-repotool. Note, however, the caveat that comes with rewriting published history, namely that it can cause problems for other developers when they will try to integrate their changes. - You can use
git revertto create the commit that undoes changes brought by an unwanted commit. - You can use
git notesto add...