Resource/other-skills/skills/git-helper/SKILL.md
This skill should be used when working with Git version control operations, including repository management, committing changes, branch operations, merging, conflict resolution, and Git workflows. Use for tasks like initializing repositories, managing branches, resolving merge conflicts, setting up remotes, or handling complex Git scenarios.
npx skillsauth add chlmm/changex-notes git-helperInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill provides specialized knowledge and workflows for Git version control operations, helping users manage repositories, branches, commits, and resolve conflicts efficiently.
Enable efficient Git operations through proven workflows, best practices, and automated assistance for common Git tasks including repository initialization, branch management, conflict resolution, and remote operations.
Use this skill when users request any Git-related operations:
Initialize a new repository:
git init
Clone an existing repository:
git clone <repository-url>
Configure user information:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
View current configuration:
git config --list
Check repository status:
git status
Stage changes for commit:
git add <file>git add .git add -iCommit staged changes:
git commit -m "Descriptive commit message"
Amend the last commit (use with caution):
git commit --amend
View commit history:
git log
git log --oneline
git log --graph --all --oneline
List branches:
git branch # Local branches
git branch -r # Remote branches
git branch -a # All branches
Create a new branch:
git branch <branch-name>
git checkout -b <branch-name> # Create and switch
Switch branches:
git checkout <branch-name>
git switch <branch-name> # Git 2.23+
Rename current branch:
git branch -m <new-name>
Delete a branch:
git branch -d <branch-name> # Only if merged
git branch -D <branch-name> # Force delete
Merge a branch into current branch:
git merge <branch-name>
Rebase current branch onto another:
git rebase <branch-name>
Abort merge/rebase in progress:
git merge --abort
git rebase --abort
View remote repositories:
git remote -v
Add a remote repository:
git remote add <name> <url>
Fetch from remote:
git fetch <remote-name>
Pull changes (fetch + merge):
git pull <remote-name> <branch-name>
Push changes to remote:
git push <remote-name> <branch-name>
Push new branch and set upstream:
git push -u <remote-name> <branch-name>
Unstage changes:
git reset HEAD <file>
Discard local changes in working directory:
git checkout -- <file>
git restore <file> # Git 2.23+
Reset to previous commit:
git reset --soft HEAD~1 # Keep changes staged
git reset --mixed HEAD~1 # Keep changes unstaged (default)
git reset --hard HEAD~1 # Discard all changes
Revert a commit (create new commit to undo):
git revert <commit-hash>
When conflicts occur during merge or rebase:
Identify conflicting files:
git status
Edit files to resolve conflicts - Look for conflict markers:
<<<<<<< HEAD
Your changes
=======
Incoming changes
>>>>>>> branch-name
Stage resolved files:
git add <resolved-file>
Complete the merge/rebase:
git commit # For merge
git rebase --continue # For rebase
Use merge tools for visual resolution:
git mergetool
Create feature branch from main:
git checkout main
git pull
git checkout -b feature/your-feature
Make commits to feature branch
Push feature branch:
git push -u origin feature/your-feature
Create pull request and merge after review
Delete feature branch after merge:
git checkout main
git branch -d feature/your-feature
Create hotfix branch from production:
git checkout production
git checkout -b hotfix/urgent-fix
Make and commit the fix
Merge hotfix to production and main:
git checkout production
git merge hotfix/urgent-fix
git checkout main
git merge hotfix/urgent-fix
Commit Messages:
Branch Naming:
feature/user-authentication, fix/login-bug, hotfix/security-patchCommit Often:
Use .gitignore:
Compare changes:
git diff # Unstaged changes
git diff --staged # Staged changes
git diff <branch1> <branch2> # Compare branches
Search commit history:
git log --grep "search-term"
git log --author "author-name"
git log --since="2024-01-01"
Show file history:
git log --follow <file>
git blame <file>
Stash changes temporarily:
git stash # Stash current changes
git stash list # List stashes
git stash pop # Apply and remove stash
git stash apply # Apply stash without removing
Clean untracked files:
git clean -f # Remove untracked files
git clean -fd # Remove untracked files and directories
HEAD detached:
git checkout <branch-name>
Large file blocking push:
git rm --cached <large-file>
git commit -m "Remove large file"
Accidentally committed sensitive data:
git filter-branch --force --index-filter \
"git rm --cached --ignore-unmatch <sensitive-file>" \
--prune-empty --tag-name-filter cat -- --all
Lost commits after reset:
git reflog # Find lost commit hash
git reset <commit-hash> # Restore from reflog
When assisting with Git operations, always:
tools
Windows CMD 命令行使用指南。提供文件操作、目录管理、网络诊断、系统管理等完整命令参考。
tools
ZeroTier - 虚拟局域网工具。创建虚拟网络,实现设备间安全互联,类似 VPN 但更轻量。
tools
Xunlong - 书签管理工具。简洁高效的书签管理和同步方案。
tools
Watcharr - 影视进度管理工具。追踪和管理你观看的电影和剧集进度。