Context
Stage changes, amend the previous commit, and force push to remote.
Workflow
- Check git status
- Verify current branch (never force push main/master)
- Stage specified files (or all with
-a) - Amend previous commit:
- Use
--no-editto keep message - Or allow editing if requested
- Use
- Force push with
--force-with-leasefor safety - Show result and final status
Safety Rules
- NEVER force push to main/master branches
- Use
--force-with-leaseinstead of--force - Verify branch has upstream tracking