agentleFS
arnabdeypolimiarnabdeypolimi/claude_code_setup/.claude/skills/git-operations/SKILL.md

git-operations

Skill4 starsChanged 6 months agoMITView on GitHub

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.

  • Deletes or force-pushes
  • Commits and pushes

5 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Files
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

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.