Back to Skills

Git

oriolrius
Updated Yesterday
42 views
1
1
1
View on GitHub
Designautomationdesign

About

This Claude Skill provides expert guidance on Git version control operations for developers working with repositories. It helps with essential commands, branch management, merging, rebasing, and conflict resolution during collaborative development. Use this skill when you need assistance with Git workflows, commits, or version control tasks.

Quick Install

Claude Code

Recommended
Plugin CommandRecommended
/plugin add https://github.com/oriolrius/pki-manager-web
Git CloneAlternative
git clone https://github.com/oriolrius/pki-manager-web.git ~/.claude/skills/Git

Copy and paste this command in Claude Code to install this skill

Documentation

Git

Expert assistance with Git version control and collaborative workflows.

Essential Commands

Repository Setup

  • git init - Initialize new repository
  • git clone <url> - Clone remote repository
  • git remote add origin <url> - Add remote
  • git remote -v - List remotes

Daily Workflow

  • git status - Check working tree status
  • git add . - Stage all changes
  • git add -p - Interactive staging
  • git commit -m "message" - Commit with message
  • git commit --amend - Amend last commit
  • git pull - Fetch and merge from remote
  • git push - Push commits to remote

Branch Management

  • git branch - List local branches
  • git branch -a - List all branches (including remote)
  • git branch <name> - Create new branch
  • git checkout <branch> - Switch to branch
  • git checkout -b <name> - Create and switch to new branch
  • git branch -d <name> - Delete branch (safe)
  • git branch -D <name> - Force delete branch
  • git push origin --delete <branch> - Delete remote branch

Viewing History

  • git log - View commit history
  • git log --oneline --graph - Compact graphical history
  • git log --author="name" - Filter by author
  • git show <commit> - Show commit details
  • git diff - Show unstaged changes
  • git diff --staged - Show staged changes
  • git diff <branch1>..<branch2> - Compare branches

Undoing Changes

  • git restore <file> - Discard working changes
  • git restore --staged <file> - Unstage file
  • git reset HEAD~1 - Undo last commit (keep changes)
  • git reset --hard HEAD~1 - Undo last commit (discard changes)
  • git revert <commit> - Create new commit that undoes changes
  • git clean -fd - Remove untracked files

Stashing

  • git stash - Stash current changes
  • git stash list - List stashes
  • git stash pop - Apply and remove last stash
  • git stash apply - Apply last stash (keep in list)
  • git stash drop - Delete last stash

Advanced Operations

Rebasing

# Rebase current branch onto main
git rebase main

# Interactive rebase (squash, reorder, edit commits)
git rebase -i HEAD~3

# Continue after resolving conflicts
git rebase --continue

# Abort rebase
git rebase --abort

Cherry-picking

# Apply specific commit to current branch
git cherry-pick <commit-hash>

# Cherry-pick without committing
git cherry-pick -n <commit-hash>

Merging

# Merge branch into current
git merge <branch>

# Merge without fast-forward (create merge commit)
git merge --no-ff <branch>

# Abort merge
git merge --abort

Conflict Resolution

# Show conflicts
git status

# After resolving conflicts in files
git add <resolved-file>
git commit

# Use theirs/ours for entire file
git checkout --theirs <file>
git checkout --ours <file>

Git Workflows

Feature Branch Workflow

# Create feature branch
git checkout -b feature/new-feature

# Work and commit
git add .
git commit -m "Add new feature"

# Update from main
git checkout main
git pull
git checkout feature/new-feature
git rebase main

# Push feature branch
git push -u origin feature/new-feature

Hotfix Workflow

# Create hotfix from main
git checkout main
git pull
git checkout -b hotfix/critical-fix

# Fix and commit
git commit -am "Fix critical bug"

# Merge back to main
git checkout main
git merge hotfix/critical-fix
git push

# Clean up
git branch -d hotfix/critical-fix

Configuration

User Setup

git config --global user.name "Your Name"
git config --global user.email "[email protected]"

Useful Aliases

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.lg "log --oneline --graph --all"

Editor

git config --global core.editor "vim"

Best Practices

  1. Commit Messages: Use clear, descriptive messages following conventional commits
  2. Small Commits: Make atomic commits that do one thing
  3. Pull Before Push: Always pull latest changes before pushing
  4. Branch Naming: Use descriptive names like feature/, bugfix/, hotfix/
  5. Never Force Push: Avoid git push --force on shared branches
  6. Review Changes: Use git diff before committing
  7. Protect Main: Never commit directly to main/master

Troubleshooting

Undo accidental commit to wrong branch

git reset HEAD~1  # Undo commit, keep changes
git stash         # Stash changes
git checkout <correct-branch>
git stash pop     # Apply changes
git add .
git commit -m "message"

Fix merge conflicts

# View conflicts
git status

# Edit conflicting files (look for <<<<<<, ======, >>>>>>)
# Remove conflict markers and keep desired code

# Mark as resolved
git add <file>
git commit

Recover deleted branch

# Find commit hash
git reflog

# Recreate branch
git checkout -b <branch-name> <commit-hash>

GitHub Repository

oriolrius/pki-manager-web
Path: .claude/skills/git
certificate-authoritycertificate-managementcosmianfastifykmspki

Related Skills

sglang

Meta

SGLang is a high-performance LLM serving framework that specializes in fast, structured generation for JSON, regex, and agentic workflows using its RadixAttention prefix caching. It delivers significantly faster inference, especially for tasks with repeated prefixes, making it ideal for complex, structured outputs and multi-turn conversations. Choose SGLang over alternatives like vLLM when you need constrained decoding or are building applications with extensive prefix sharing.

View skill

langchain

Meta

LangChain is a framework for building LLM applications using agents, chains, and RAG pipelines. It supports multiple LLM providers, offers 500+ integrations, and includes features like tool calling and memory management. Use it for rapid prototyping and deploying production systems like chatbots, autonomous agents, and question-answering services.

View skill

content-collections

Meta

This skill provides a production-tested setup for Content Collections, a TypeScript-first tool that transforms Markdown/MDX files into type-safe data collections with Zod validation. Use it when building blogs, documentation sites, or content-heavy Vite + React applications to ensure type safety and automatic content validation. It covers everything from Vite plugin configuration and MDX compilation to deployment optimization and schema validation.

View skill

Algorithmic Art Generation

Meta

This skill helps developers create algorithmic art using p5.js, focusing on generative art, computational aesthetics, and interactive visualizations. It automatically activates for topics like "generative art" or "p5.js visualization" and guides you through creating unique algorithms with features like seeded randomness, flow fields, and particle systems. Use it when you need to build reproducible, code-driven artistic patterns.

View skill