Skip to content
Back to skills

Git Operations Benjaminrose805 React Basecamp

ASecurity

Git command procedures for branch management, commits, and worktrees.

  • 666 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added February 8, 2026
documentationbashreactgitapidocumentation

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill git-operations-benjaminrose805-react-basecamp --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Git Operations Benjaminrose805 React Basecamp?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Git Operations Benjaminrose805 React Basecamp
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-git-operations-benjaminrose805-react-basecamp/badge)](https://www.skillsdirectory.com/skills/majiayu000-git-operations-benjaminrose805-react-basecamp)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: git-operations
description: Git command procedures for branch management, commits, and worktrees.
---

# Git Operations Skill

Git command procedures for branch management, commits, and worktrees.

## When Used

| Agent     | Phase       |
| --------- | ----------- |
| git-agent | All actions |

## CLI Tools

All operations use native git and GitHub CLI (`gh`):

```bash
# Verify gh CLI is authenticated
gh auth status

# If not authenticated, run:
gh auth login
```

**Note:** The github MCP server has been replaced with `gh` CLI commands. See pr-operations skill for PR-related commands.

## Procedures

### 1. Status

Show current git state:

```bash
git status
git log --oneline -5
git branch -vv
```

**Output:** Current branch, uncommitted changes, recent commits.

---

### 2. Branch Create

Create and switch to a new branch:

```bash
git checkout -b <type>/<name>
```

**Branch Types:**

| Prefix      | Use For           | Example                  |
| ----------- | ----------------- | ------------------------ |
| `feature/`  | New features      | `feature/prompt-manager` |
| `fix/`      | Bug fixes         | `fix/auth-timeout`       |
| `refactor/` | Code improvements | `refactor/api-cleanup`   |
| `docs/`     | Documentation     | `docs/api-reference`     |

**Validation:**

- Never create branch from dirty working directory
- Always branch from up-to-date main

```bash
git fetch origin
git checkout main
git pull origin main
git checkout -b <type>/<name>
```

---

### 3. Branch Switch

Switch to an existing branch:

```bash
git checkout <branch>
```

**With uncommitted changes:**

```bash
# Option 1: Stash changes
git stash
git checkout <branch>

# Option 2: Commit first
git add <files>
git commit -m "wip: save progress"
git checkout <branch>
```

---

### 4. Sync with Main

Update current branch with latest main:

```bash
git fetch origin
git rebase origin/main
```

**On conflict:**

```bash
# Fix conflicts in files
git add <resolved-files>
git rebase --continue
```

**If rebase is problematic:**

```bash
git rebase --abort
git merge origin/main
```

---

### 5. Commit

Create a conventional commit:

```bash
# Stage specific files (never use -A or .)
git add <file1> <file2>

# Commit with message
git commit -m "<type>: <description>

<optional body>

Co-Authored-By: Claude <noreply@anthropic.com>"
```

**Commit Types:**

| Type       | Use For                                 |
| ---------- | --------------------------------------- |
| `feat`     | New feature                             |
| `fix`      | Bug fix                                 |
| `refactor` | Code change that neither fixes nor adds |
| `docs`     | Documentation only                      |
| `test`     | Adding or updating tests                |
| `chore`    | Maintenance, dependencies               |

**Pre-commit checks:**

```bash
pnpm lint && pnpm typecheck
```

---

### 6. Worktree Add

Create a new worktree for parallel development:

```bash
# Create worktree with new branch
git worktree add ../<repo>--<feature> -b feature/<feature>

# Create worktree from existing branch
git worktree add ../<repo>--<feature> feature/<feature>
```

**Example:**

```bash
git worktree add ../react-basecamp--prompt-manager -b feature/prompt-manager
```

**Directory structure:**

```
~/basecamp/
├── react-basecamp/                  # Main worktree (main branch)
├── react-basecamp--prompt-manager/  # Worktree for feature
└── react-basecamp--other-feature/   # Another worktree
```

---

### 7. Worktree Remove

Remove a worktree when done:

```bash
git worktree remove ../<repo>--<feature>
```

**If worktree has uncommitted changes:**

```bash
# Force remove (discards changes)
git worktree remove --force ../<repo>--<feature>

# Or commit/stash changes first
cd ../<repo>--<feature>
git stash
cd ../<repo>
git worktree remove ../<repo>--<feature>
```

---

### 8. Worktree List

Show all worktrees:

```bash
git worktree list
```

---

### 9. Cleanup

Delete merged branches:

```bash
# Delete local merged branches
git branch --merged main | grep -v "main" | xargs -r git branch -d

# Prune remote-tracking branches
git fetch --prune
```

## Error Handling

| Error             | How to Handle                            |
| ----------------- | ---------------------------------------- |
| Merge conflict    | Resolve manually, then continue          |
| Dirty working dir | Stash or commit before switching         |
| Branch exists     | Check if intentional, use different name |
| Worktree locked   | Remove lock file or use --force          |

## Output

Return operation result:

```markdown
## Git Operation: <action>

**Status:** SUCCESS / FAILED

**Details:**

- <operation-specific details>

**Current State:**

- Branch: `feature/prompt-manager`
- Uncommitted: 0 files
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.