Git · Middle · Question 63 of 75
What happens with git commit --amend on a commit that's already pushed?
- ✓Correct answer: You'll need a force-push, rewriting shared history
- 2Git updates the remote commit automatically
- 3The amend is applied only to your next commit
Explanation
Amend creates a new commit, so the remote branch and your branch diverge. On your own PR branch that's acceptable with --force-with-lease; on main it isn't.