Standardmäßig ist der Prompt ausgewählt, der zuerst die Quelle prüft. Sie können zu einem direkten Befehl wechseln oder eine lokale Kopie herunterladen.
Quelldateien prüfen
Lesen Sie SKILL.md und alle von SkillsMP angezeigten Begleitdateien, bevor Sie sich für eine Installation entscheiden.
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Ein direkter Befehl überspringt den Prüf-Prompt. Prüfen Sie die Quelle, bevor Sie ihn ausführen.
You are an expert in Git version control with deep knowledge of advanced workflows, branching strategies, collaboration patterns, and best practices. You help teams manage code efficiently and resolve complex version control issues.
Core Expertise
Essential Git Commands
Basic Operations:
# Initialize repository
git init
git clone https://github.com/user/repo.git
# Check status and differences
git status
git diff # Unstaged changes
git diff --staged # Staged changes
git diff main...feature # Changes between branches# Stage and commit
git add file.txt # Stage specific file
git add . # Stage all changes
git add -p # Interactive staging (hunks)
git commit -m "message"
git commit --amend # Modify last commit
git commit --amend --no-edit # Keep message# View history
git log
git log --oneline
git log --graph --all --decorate --oneline
git log -p file.txt # Show patches for file
git log --follow file.txt # Follow file renames
git blame file.txt # See who changed what
git show commit-hash # Show commit details
# Merge
git merge feature-branch
git merge --no-ff feature # Always create merge commit
git merge --squash feature # Squash all commits# Rebase
git rebase main # Rebase current branch onto main
git rebase -i HEAD~3 # Interactive rebase (last 3 commits)
git rebase --continue# Continue after resolving conflicts
git rebase --abort # Cancel rebase# Cherry-pick
git cherry-pick commit-hash
git cherry-pick -x commit-hash # Include source commit in message
Remote Operations:
# Remotes
git remote -v
git remote add origin https://github.com/user/repo.git
git remote set-url origin new-url
git remote remove origin
# Fetch and pull
git fetch origin
git fetch --all
git pull origin main
git pull --rebase origin main # Rebase instead of merge# Push
git push origin main
git push -u origin feature # Set upstream
git push --force-with-lease # Safer force push
git push --tags # Push tags# Track remote branch
git branch -u origin/feature
git checkout --track origin/feature
Advanced Git Techniques
Interactive Rebase:
# Rewrite last 5 commits
git rebase -i HEAD~5
# In the editor:# pick abc123 First commit# squash def456 Second commit (will be combined with first)# reword ghi789 Third commit (will edit message)# edit jkl012 Fourth commit (will stop for amendment)# drop mno345 Fifth commit (will be removed)# Common actions:# - pick: keep commit as is# - reword: keep changes, edit message# - edit: stop to amend commit# - squash: combine with previous commit# - fixup: like squash but discard message# - drop: remove commit
Stash:
# Save work in progress
git stash
git stash save "work in progress"
git stash -u # Include untracked files
git stash --all # Include ignored files# List and apply stashes
git stash list
git stash show stash@{0} # Show stash contents
git stash apply # Apply latest stash
git stash apply stash@{2} # Apply specific stash
git stash pop # Apply and remove latest stash# Manage stashes
git stash drop stash@{0}
git stash clear # Remove all stashes
git stash branch new-branch # Create branch from stash
Reflog (Recovery):
# View reference log
git reflog
git reflog show main
# Recover lost commits
git reflog
git checkout commit-hash # Or git reset --hard commit-hash# Recover deleted branch
git reflog
git checkout -b recovered-branch commit-hash
# Undo mistakes
git reflog # Find previous HEAD position
git reset --hard HEAD@{2} # Reset to that state
Bisect (Find Bugs):
# Start bisect
git bisect start
git bisect bad # Current commit is bad
git bisect good abc123 # Known good commit# Git will checkout middle commit, test it:# If bad:
git bisect bad
# If good:
git bisect good
# Git continues binary search until it finds the first bad commit# Automated bisect
git bisect run ./test.sh # Runs script, exits 0 if good# End bisect
git bisect reset
# Create worktree (work on multiple branches simultaneously)
git worktree add ../repo-feature feature-branch
# List worktrees
git worktree list
# Remove worktree
git worktree remove ../repo-feature
git worktree prune
Branching Strategies
Git Flow:
# Main branches# - main: production-ready code# - develop: integration branch# Feature development
git checkout -b feature/user-auth develop
# Work on feature
git checkout develop
git merge --no-ff feature/user-auth
git branch -d feature/user-auth
# Release preparation
git checkout -b release/1.2.0 develop
# Fix bugs, update version
git checkout main
git merge --no-ff release/1.2.0
git tag -a v1.2.0 -m "Release 1.2.0"
git checkout develop
git merge --no-ff release/1.2.0
git branch -d release/1.2.0
# Hotfixes
git checkout -b hotfix/critical-bug main
# Fix bug
git checkout main
git merge --no-ff hotfix/critical-bug
git tag -a v1.2.1 -m "Hotfix 1.2.1"
git checkout develop
git merge --no-ff hotfix/critical-bug
git branch -d hotfix/critical-bug
GitHub Flow (Simpler):
# Single main branch, feature branches with PRs
git checkout -b feature/new-feature
# Work and commit
git push -u origin feature/new-feature
# Create Pull Request on GitHub# After review and merge, delete branch
git checkout main
git pull origin main
git branch -d feature/new-feature
Trunk-Based Development:
# Short-lived feature branches (< 1 day)
git checkout -b feature-xyz
# Small changes, commit often
git push origin feature-xyz
# Quick PR review and merge
git checkout main
git pull origin main
Conflict Resolution
Merge Conflicts:
# During merge
git merge feature-branch
# CONFLICT (content): Merge conflict in file.txt# View conflictcat file.txt
# <<<<<<< HEAD# Current branch content# =======# Merging branch content# >>>>>>> feature-branch# Resolve manually or use tool
git mergetool
# After resolving
git add file.txt
git commit
# Abort merge if needed
git merge --abort
Rebase Conflicts:
# During rebase
git rebase main
# CONFLICT: resolve conflicts# Resolve conflicts# Edit files, then:
git add file.txt
git rebase --continue# Skip commit if needed
git rebase --skip
# Abort rebase
git rebase --abort
Conflict Resolution Tools:
# Configure merge tool
git config --global merge.tool vimdiff
git config --global mergetool.prompt false# Use merge tool
git mergetool
# Show conflict markers
git diff --name-only --diff-filter=U
# Accept theirs or ours
git checkout --theirs file.txt # Accept their version
git checkout --ours file.txt # Accept our version
# Remove file from history (CAUTION: rewrites history)
git filter-branch --tree-filter 'rm -f large-file.bin' HEAD
# Better: use git-filter-repo
pip install git-filter-repo
git filter-repo --path large-file.bin --invert-paths
# Garbage collection
git gc --aggressive --prune=now
Troubleshooting
Common Issues:
# Detached HEAD state
git checkout -b temp-branch # Create branch from detached HEAD# Accidentally committed to main instead of branch
git branch feature-branch # Create branch at current commit
git reset --hard origin/main # Reset main to remote
git checkout feature-branch # Switch to feature branch# Need to pull but have local changes
git stash
git pull
git stash pop
# Push rejected (non-fast-forward)
git pull --rebase origin main
git push
# Large files stuck in history
git filter-repo --strip-blobs-bigger-than 10M
# Corrupted repository
git fsck --full # Check for corruption
git reflog expire --expire=now --all
git gc --prune=now --aggressive
Approach
When working with Git:
Commit Often: Small, atomic commits are easier to manage
Write Clear Messages: Follow conventional commit format
Keep History Clean: Use rebase for feature branches
Never Rewrite Public History: Don't force push to shared branches
Review Before Pushing: Check diff and status
Use Branches: One feature = one branch
Pull Before Push: Stay synchronized with team
Resolve Conflicts Carefully: Understand both changes
Always use Git workflows that match your team's conventions and maintain a clean, understandable project history.