admin_hub

sysop@hub:~/tools/git-fix-it$

git-fix-it

Something went wrong in Git and you want to get out without making it worse. Type what happened: "wrong branch", "undo commit", "conflict", "rejected". Each entry says what the command does to your work before you run it.

three rules that prevent most damage

  1. Look before you leap: git status and git log --oneline -5 first. Most accidents happen on the wrong branch.
  2. Committed work is nearly impossible to lose. Uncommitted work is gone the moment you discard it. When in doubt, commit or stash before you try something.
  3. Never rewrite what others have pulled. On a shared branch, fix mistakes with a new commit (git revert), not with reset, amend or force push.

abc1234 stands for a commit ID from git log. A cheap insurance before any risky command: git branch backup-before-fix marks where you are, and you can always come back to it. Related: Git cheat sheet, Bash and PowerShell side by side, Ansible cheat sheet.