From 256ffc5e42ea552c54f6e1050af6ecf56d86e805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Csaba=20Attila=20Bir=C3=B3?= Date: Sat, 28 Mar 2026 00:09:55 +0100 Subject: [PATCH] docs: expand troubleshooting with 5 additional edge cases Add recovery steps for: wrong base branch, merge conflicts, deleted branch, committed secrets, and wrong merge target. --- SKILL.md | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/SKILL.md b/SKILL.md index a9c952d..8ffd01e 100644 --- a/SKILL.md +++ b/SKILL.md @@ -603,3 +603,68 @@ git cherry-pick ``` > **Warning:** Cherry-picking duplicates commits. Prefer merging or back-merging when possible. Use cherry-pick only for isolated, urgent fixes. + +### "I created a branch from main instead of develop" + +```bash +# If no commits yet — just recreate from the correct base +git checkout develop +git pull origin develop +git checkout -b feature/- + +# If you already have commits — rebase them onto develop +git rebase --onto develop main feature/- +``` + +### "My PR has merge conflicts" + +```bash +# Merge the target branch into your feature branch +git checkout feature/- +git merge develop + +# Resolve conflicts in your editor, then: +git add +git commit # accept the merge commit message + +# Push the resolution +git push origin feature/- +``` + +> **Note:** Never rebase a branch that's already pushed or has an open PR. Use merge to incorporate upstream changes. + +### "I accidentally deleted a branch before it was merged" + +```bash +# Find the branch tip in reflog +git reflog show --all | grep + +# Recreate the branch from the last known commit +git checkout -b +git push -u origin +``` + +### "I committed secrets or credentials" + +```bash +# Remove the file from history (requires git-filter-repo) +git filter-repo --path --invert-paths + +# Force-push all affected branches (coordinate with team first) +git push --force-with-lease origin +``` + +> **Critical:** After removing from git history, you must also: +> 1. **Rotate the exposed credentials immediately** — assume they are compromised +> 2. **Check GitHub's push protection** — enable secret scanning if not already active +> 3. Force-push is normally forbidden, but this is a security exception + +### "I merged the wrong branch into develop or main" + +```bash +# Revert the merge commit (use -m 1 to keep the mainline parent) +git revert -m 1 +git push origin +``` + +> **Note:** Reverting a merge makes Git think those changes were already applied. If you need to re-merge the branch later, you must first revert the revert.