Git
by @ivangdavila
Git commits, branches, rebases, merges, conflict resolution, history recovery, team workflows, and the commands needed for safe day-to-day version control. U...
clawhub install gitπ About This Skill
name: Git slug: git version: 1.0.8 description: "Git commits, branches, rebases, merges, conflict resolution, history recovery, team workflows, and the commands needed for safe day-to-day version control. Use when (1) the task touches Git, a repository, commits, branches, merges, rebases, or pull requests; (2) history safety, collaboration, or recovery matter; (3) the agent should automatically apply Git discipline instead of improvising." homepage: https://clawic.com/skills/git changelog: Simplified the skill name and kept the stateless activation guidance metadata: {"clawdbot":{"emoji":"π","requires":{"bins":["git"]},"os":["linux","darwin","win32"]}}
When to Use
Use when the task involves Git repositories, branches, commits, merges, rebases, pull requests, conflict resolution, history inspection, or recovery. This skill is stateless and should be applied by default whenever Git work is part of the job.
Quick Reference
| Topic | File |
|-------|------|
| Essential commands | commands.md |
| Advanced operations | advanced.md |
| Branch strategies | branching.md |
| Conflict resolution | conflicts.md |
| History and recovery | history.md |
| Team workflows | collaboration.md |
Core Rules
1. Never force push to shared branches β Use --force-with-lease on feature branches only
2. Commit early, commit often β Small commits are easier to review, revert, and bisect
3. Write meaningful commit messages β First line under 72 chars, imperative mood
4. Pull before push β Always git pull --rebase before pushing to avoid merge commits
5. Clean up before merging β Use git rebase -i to squash fixup commits
Team Workflows
Feature Branch Flow:
1. git checkout -b feature/name from main
2. Make commits, push regularly
3. Open PR, get review
4. Squash and merge to main
5. Delete feature branch
Hotfix Flow:
1. git checkout -b hotfix/issue from main
2. Fix, test, commit
3. Merge to main AND develop (if exists)
4. Tag the release
Daily Sync:
git fetch --all --prune
git rebase origin/main # or merge if team prefers
Commit Messages
type(scope): descriptionfeat, fix, docs, style, refactor, test, chorePush Safety
git push --force-with-lease instead of --force β prevents overwriting others' workgit pull --rebase before retryingConflict Resolution
grep -r "<<<\|>>>\|===" .git merge --abort and try git rebase insteadBranch Hygiene
git branch -d branch-namegit fetch --prunegit rebase -i to squash messy commits before pushingSafety Checklist
Before destructive operations (reset --hard, rebase, force push):
git branch to verifygit fetch firstCommon Traps
git config user.email before important commits.gitkeep--recurse-submodulesgit switch - to return to previous branchgit pull --rebase firststash apply insteadRecovery Commands
git reset --soft HEAD~1git restore filenamegit reflog (keeps ~90 days of history)git checkout -b branch-name git add -p for partial staging when commit mixes multiple changesDebugging with Bisect
Find the commit that introduced a bug:
git bisect start
git bisect bad # current commit is broken
git bisect good v1.0.0 # this version worked
Git checks out middle commit, test it, then:
git bisect good # or git bisect bad
Repeat until Git finds the culprit
git bisect reset # return to original branch
Quick Summary
git status -sb # short status with branch
git log --oneline -5 # last 5 commits
git shortlog -sn # contributors by commit count
git diff --stat HEAD~5 # changes summary last 5 commits
git branch -vv # branches with tracking info
git stash list # pending stashes
Related Skills
Install withclawhub install if user confirms:
gitlab β GitLab CI/CD and merge requestsdocker β Containerization workflowscode β Code quality and best practicesFeedback
clawhub star gitclawhub syncβ‘ When to Use
Use when the task involves Git repositories, branches, commits, merges, rebases, pull requests, conflict resolution, history inspection, or recovery. This skill is stateless and should be applied by default whenever Git work is part of the job.