Help us improve
Share bugs, ideas, or general feedback.
From core
Essential Git version control knowledge including repositories, commits, branches, remotes, and common workflows. Use when helping with basic Git operations, teaching Git concepts, or as foundation for advanced Git tools. Activate for questions about Git basics, standard workflows, or version control fundamentals.
npx claudepluginhub amitkot/claude-code-tools --plugin coreHow this skill is triggered — by the user, by Claude, or both
Slash command
/core:git-fundamentalsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Use this skill when:
Guides technical evaluation of code review feedback: read fully, restate for understanding, verify against codebase, respond with reasoning or pushback before implementing.
Share bugs, ideas, or general feedback.
Use this skill when:
Do NOT use for:
A Git repository is a directory that tracks changes to files over time.
Key points:
.git/ directory with version historygit init or cloned with git cloneSnapshots of your project at specific points in time.
Characteristics:
abc123)Independent lines of development in a repository.
Key points:
main or masterWorking Directory → Staging Area → Repository
(modified files) (git add) (git commit)
A version of your repository hosted elsewhere (e.g., GitHub, GitLab).
Common operations:
git clone: Copy remote repository locallygit push: Send commits to remotegit pull: Fetch and merge remote changesgit fetch: Get remote changes without merging# Initialize new repository
git init
# Or clone existing repository
git clone https://github.com/username/repo.git
cd repo
# 1. Check status
git status
# 2. Make changes (edit files in your editor)
# 3. Stage changes
git add file1.txt file2.txt
# Or stage all changes
git add .
# 4. Commit changes
git commit -m "Add feature X"
# 5. Push to remote
git push origin main
# View commit history
git log
# Compact history
git log --oneline
# Graphical history
git log --graph --all --decorate
# Show specific commit
git show abc123
# List branches
git branch
# Create new branch
git branch feature-name
# Switch to branch
git checkout feature-name
# Or with newer syntax
git switch feature-name
# Create and switch in one command
git checkout -b feature-name
# Or
git switch -c feature-name
# Delete branch
git branch -d feature-name
# Switch to target branch
git checkout main
# Merge feature branch
git merge feature-branch
# If conflicts occur:
# 1. Edit files to resolve conflicts
# 2. Stage resolved files
git add resolved-file.txt
# 3. Complete merge
git commit
# View remotes
git remote -v
# Add remote
git remote add origin https://github.com/username/repo.git
# Fetch changes
git fetch origin
# Pull changes (fetch + merge)
git pull origin main
# Push changes
git push origin main
# Push new branch
git push -u origin feature-branch
# Discard changes in working directory
git restore file.txt
# Or (older syntax)
git checkout -- file.txt
# Unstage file (keep changes)
git restore --staged file.txt
# Or (older syntax)
git reset HEAD file.txt
# Amend last commit (not pushed yet)
git commit --amend
# Revert commit (create new commit that undoes)
git revert abc123
<type>: <subject>
<body>
<footer>
Good examples:
Add user authenticationFix memory leak in parserUpdate dependencies to latest versionsBad examples:
fixed bug (not imperative, not descriptive)Added a new feature that allows users to authenticate using OAuth (too long)stuff (not descriptive)feat: New featurefix: Bug fixdocs: Documentation onlystyle: Formatting, missing semi-colons, etc.refactor: Code restructuringtest: Adding testschore: Maintenance tasks# 1. Ensure you're on main and up to date
git checkout main
git pull origin main
# 2. Create feature branch
git checkout -b feature-user-auth
# 3. Make changes and commit
# ... edit files ...
git add .
git commit -m "Add user login form"
# 4. Continue development
# ... more edits ...
git commit -m "Add authentication logic"
# 5. Push feature branch
git push -u origin feature-user-auth
# See what changed
git status
# See detailed changes
git diff
# See changes for specific file
git diff path/to/file.txt
# See staged changes
git diff --staged
Made changes but want to start over:
# Discard all working directory changes
git restore .
Committed to wrong branch:
# On wrong branch
git log # Note the commit SHA
# Switch to correct branch
git checkout correct-branch
# Cherry-pick the commit
git cherry-pick abc123
# Go back and remove from wrong branch
git checkout wrong-branch
git reset --hard HEAD~1
# Update your main branch
git checkout main
git pull origin main
# Update your feature branch with main's changes
git checkout feature-branch
git merge main
# Resolve any conflicts, then push
git push origin feature-branch
git status # Check working directory status
git log # View commit history
git log --oneline # Compact history
git diff # View changes
git show <commit> # Show specific commit
git branch # List branches
git remote -v # List remotes
git add <file> # Stage file
git add . # Stage all changes
git commit -m "msg" # Commit staged changes
git commit -am "msg" # Stage all tracked files and commit
git branch <name> # Create branch
git checkout <name> # Switch branch
git switch <name> # Switch branch (newer)
git checkout -b <name> # Create and switch
git branch -d <name> # Delete branch
git merge <branch> # Merge branch into current
git clone <url> # Clone repository
git fetch # Fetch remote changes
git pull # Fetch and merge
git push # Push commits
git push -u origin <br> # Push new branch
git restore <file> # Discard working directory changes
git restore --staged # Unstage file
git commit --amend # Modify last commit
git revert <commit> # Create commit that undoes changes
# Set your identity
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
# Set default editor
git config --global core.editor "vim"
# Set default branch name
git config --global init.defaultBranch main
# View configuration
git config --list
# Create shortcuts
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.unstage 'restore --staged'
git config --global alias.last 'log -1 HEAD'
git config --global alias.lg 'log --oneline --graph --all'
# Now you can use:
git co main # instead of git checkout main
git st # instead of git status
Create .gitignore file to exclude files from version control:
# Dependencies
node_modules/
vendor/
# Environment files
.env
.env.local
# Build outputs
dist/
build/
*.pyc
# IDE files
.vscode/
.idea/
*.swp
# OS files
.DS_Store
Thumbs.db
Solution: Push your commits
git push origin main
Solution: Pull remote changes
git pull origin main
Solution:
<<<<<<<, =======, >>>>>>>git add <file>git commitSolution: You're not in a Git repository
# Either initialize one
git init
# Or clone existing repository
git clone <url>
Solution: SSH keys not set up
# Check if you have SSH keys
ls ~/.ssh
# If not, generate them
ssh-keygen -t ed25519 -C "your.email@example.com"
# Add to ssh-agent
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
# Add public key to GitHub/GitLab/etc
cat ~/.ssh/id_ed25519.pub
git diff and git status.gitignore for secretsfeature/user-auth not stuff# Start
git init / git clone <url>
# Daily workflow
git status
git add <files>
git commit -m "message"
git push
# Branching
git branch <name>
git checkout <name>
git merge <branch>
# Sync
git pull
git fetch
# Undo
git restore <file>
git restore --staged <file>
git commit --amend
# History
git log
git show <commit>
git diff
git status constantly - it's your friend