Troubleshooting¶
If you are unsure just contact someone via e.g. Telegram before changing anything.
Undoing Local Changes¶
Discard Unstaged Changes¶
Discard all local unstaged changes:
Unstage Files¶
Amend Last Commit (Before Push)¶
Use only if: - Commit is not pushed - You are on your own branch
Fixing a Wrong Commit (Not Yet Pushed)¶
Soft Reset (Keep Changes)¶
Moves HEAD back one commit but keeps changes staged.
Mixed Reset (Keep Changes Unstaged)¶
Hard Reset (Dangerous)¶
Removes commit and changes permanently.
Use only if: - Changes are not needed - Commit was not pushed
Fixing a Pushed Commit (Feature Branch)¶
If the branch is not shared, you may:
Then:
Allowed only if:
- It is your own branch
- No one else is working on it
- No admin restriction applies
If unsure, contact admin.
Never Rewrite main¶
- Do not rebase
main - Do not reset
main - Do not force push to
main - Fix issues via a new PR
Revert a Commit (Safe for Shared Branches)¶
If something is already merged to main:
Creates a new commit that undoes the change.
Push normally and open a PR if required.
Handling Conflicts¶
When rebasing or merging:
<<<<<<< HEAD
current changes
=======
incoming changes
>>>>>>> branch
Resolution flow:
- Edit file
- Remove conflict markers
- Stage file:
- Continue:
Abort if needed:
Detached HEAD¶
If you see:
You are in 'detached HEAD' state
Fix by switching to a branch:
Or create a branch from current state:
Lost Commits Recovery¶
Use reflog:
Find commit hash, then:
Or restore:
Accidentally Committed to Wrong Branch¶
If not pushed:
If pushed to a feature branch: - Fix on that branch\
- Or revert
If pushed to main: - Immediately inform admin\
- Create revert PR
CI Fails After Merge¶
- Identify failing job
- Fix issue in a new branch
- Open hotfix PR
- Follow full review process
Never push directly to main to apply a quick fix.
When to Contact Admin¶
- Accidental push to
main - Force push required
- Branch protection violation
- Corrupted history
- Unrecoverable merge situation