AGENT SKILL

git-operations

Common git operation patterns and commands. Use when working with git branches, commits, staging, rebasing, stashing, or any other git operations. Triggers include branching, committing, merging, rebasing, and syncing with remote repositories.

License 许可
MIT
最近更新
2026-09-17
Stars
★ 5
Forks
0

01 前言 Front Matter

name
git-operations
description
Common git operation patterns and commands. Use when working with git branches, commits, staging, rebasing, stashing, or any other git operations. Triggers include branching, committing, merging, rebasing, and syncing with remote repositories.

03 SKILL.md 正文

Git Operations

Reusable patterns for common git operations in this repository.

Branch Operations

Create Feature Branch

git checkout main
git pull origin main
git checkout -b feature/<name>

Create Task Branch (Cascade)

git checkout <parent-branch>
git checkout -b task-N-<description>

Delete Branch

git branch -d <branch-name>          # Safe delete
git branch -D <branch-name>          # Force delete
git push origin --delete <branch-name>  # Delete remote

List Branches

git branch                           # Local branches
git branch -r                        # Remote branches
git branch -a                        # All branches

Commit Operations

Standard Commit

git add <files>
git commit -m "<type>(<scope>): <description>"

Commit Types

  • feat - New feature
  • fix - Bug fix
  • docs - Documentation
  • style - Formatting
  • refactor - Code restructuring
  • test - Tests
  • chore - Maintenance

Amend Last Commit

git commit --amend -m "new message"  # Change message only
git add <files> && git commit --amend --no-edit  # Add files to last commit

View Commit History

git log --oneline -10                # Recent commits
git log --oneline --graph -20        # With graph
git log --oneline -- <file>          # For specific file

Staging Operations

Stage Files

git add file1.py file2.py            # Specific files
git add "*.py"                       # By pattern
git add .                            # All changes

Unstage Files

git restore --staged <file>

View Changes

git diff                             # Unstaged changes
git diff --staged                    # Staged changes

Sync Operations

Fetch Updates

git fetch origin

Pull Changes

git pull origin <branch>

Push Changes

git push origin <branch>             # Normal push
git push -u origin <branch>          # Set upstream
git push --force-with-lease origin <branch>  # Force push (use carefully!)

Rebase Operations

Rebase on Branch

git checkout <feature-branch>
git rebase <base-branch>

Interactive Rebase

git rebase -i HEAD~<n>

Continue After Conflict

# After resolving conflicts
git add <resolved-files>
git rebase --continue

Abort Rebase

git rebase --abort

Stash Operations

Stash Changes

git stash
git stash push -m "description"

List Stashes

git stash list

Apply Stash

git stash pop                        # Apply and remove
git stash apply                      # Apply and keep

Drop Stash

git stash drop stash@{0}

Diff Operations

Compare Branches

git diff main..feature-branch

Compare Commits

git diff <commit1>..<commit2>

Show Changed Files

git diff --name-only main..HEAD

Reset Operations

Soft Reset (keep changes staged)

git reset --soft HEAD~1

Mixed Reset (keep changes unstaged)

git reset HEAD~1

Hard Reset (discard changes)

git reset --hard HEAD~1

Cherry Pick

Pick Single Commit

git cherry-pick <commit-sha>

Pick Without Commit

git cherry-pick --no-commit <commit-sha>

Tags

Create Tag

git tag v1.0.0
git tag -a v1.0.0 -m "Release 1.0.0"

Push Tags

git push origin v1.0.0
git push origin --tags

Safety Guidelines

  1. Never force push to main
  2. Use --force-with-lease instead of --force
  3. Always pull before pushing
  4. Review diff before committing
  5. Don't commit sensitive data

04 同仓库更多 Skills

arnabdeypolimi
arnabdeypolimi/claude_code_setup

git-operations

暂无简介

★ 5
arnabdeypolimi
arnabdeypolimi/claude_code_setup

python-best-practices

暂无简介

★ 5
arnabdeypolimi
arnabdeypolimi/claude_code_setup

typst-paper

Typst academic paper assistant for existing `.typ` paper projects in English or Chinese. Use this skill whenever the user wants to compile, audit, or improve a Typst paper, including format checks, bibliography validation for BibTeX or Hayagriva, grammar/sentence/logic review, expression polishing, translation, title optimization, pseudocode review, algorithm block cleanup, de-AI editing, or experiment-section review. Trigger even when the user only mentions one Typst file, one bibliography issue, one pseudocode block, or one section rewrite. Also trigger when the user mentions ".typ files", "typst compile error", "typst export", "typst bibliography", `algorithm-figure`, `lovelace`, or `algorithmic` even without saying the word "Typst" explicitly.

★ 5
arnabdeypolimi
arnabdeypolimi/claude_code_setup

typeset

Improves typography by fixing font choices, hierarchy, sizing, weight, and readability so text feels intentional. Use when the user mentions fonts, type, readability, text hierarchy, sizing looks off, or wants more polished, intentional typography.

★ 5
arnabdeypolimi
arnabdeypolimi/claude_code_setup

teach-impeccable

One-time setup that gathers design context for your project and saves it to your AI config file. Run once to establish persistent design guidelines.

★ 5
arnabdeypolimi
arnabdeypolimi/claude_code_setup

research-paper-writing

Improve academic paper writing quality for ML/CV/NLP-style papers with clear section structure, paragraph flow, and reviewer-facing presentation. Use when drafting or revising Abstract, Introduction, Related Work, Method, Experiments, or Conclusion; polishing figures/tables; checking claim-support alignment; or performing self-review before submission.

★ 5