Amend commits, rewrite history, force-push safely, tag releases, create patches, manage submodules, and automate checks with Git hooks.
Fix the message of the last commit
git commit --amend -m "Message"Add a forgotten file to the last commit, keeping its message
git add "forgotten-file"git commit --amend --no-editNote: only force-push branches you own (e.g. after a rebase). --force-with-lease aborts if someone else pushed first.
After amending or rebasing already-pushed commits
git push --force-with-leaseCreate a tag named v1.0.0
git tag v1.0.0Show tags
git tag -lStores message/author/date
git tag -a v1.0.0 -m "First stable release"Push v1.0.0 tag to the remote
git push origin v1.0.0Push all tags to the remote
git push origin --tagsDelete a tag locally
git tag -d v1.0.0Delete a tag on the remote
git push origin --delete v1.0.0