When you amend a GitGit
Git is a version control system used to track changes on files and make it easier for multiple people to collaborate on the same set of files.
This note serves as a link to connect Git-related not... commit, you will have to force push it to remote, which can cause you to overwrite someone's commit which was pushed in the meantime.
Using push flag --force-with-lease
instead of --force
will not allow you to force push your amended commit if it would overwrite a commit on the remote. You will get an error, pull the remote changes and just repeat the push command.
git commit --amend
git push --force-with-lease
You can go a step further and create a git alias
git config --global alias.kindly "push --force-with-lease"
Which allows you to run git kindly
next time you need to "kindly" force push things.
Status: #💡
Part of Git RunbooksGit Runbooks
This note serves as a collection of [[Git]]-related how-to guides that lead you through the steps of solving real-world problems. To use it, follow the linked mentions below.