Question regarding commits that float around after an --amend:
Push a commit with a reference to an issue:
git add foo.py
git add README.md
git commit -m “Fixes a thing. Issue reference: #164”
git push origin my-cool-pr
Realizing you forgot something, you --amend:
git add bar.py
git commit -a --amend
git push origin my-cool-pr -f
3. It’s not your day, you made a spelling mistake in README.md
vim README.md git add README.md git commit -a --amend git push origin my-cool-pr -f
Now visit issue #164. It will have 3 ‘back-references’ to those individual commits. However, only the last one is relevant, since you’ve been amending.
How do I delete those commits that are still floating around?