git safety
rules for git operations in this repo.
rules
- NEVER force push (
git push --forceorgit push -f) - NEVER
git reset --hardwithout explicit permission - NEVER
git clean -fdwithout explicit permission - prefer
git stashovergit reset - always
git pullbeforegit push
forbidden commands
these require EXPLICIT user permission:
git push --forcegit push -fgit push --force-with-leasegit reset --hardgit clean -fdgit checkout -- .(discards all changes)
safe alternatives
instead of git reset --hard:
git stashto save changesgit stash popto restore
instead of force push:
git pull --rebasethen normal push- ask user how to resolve conflicts
workflow
git pullbefore making changes- make changes
git addrelevant filesgit commitgit pullagain before pushgit push(no force flags)