Git Workflow

VerifiedCaution

Git operations and pull request workflows. Create PRs, rebase branches, resolve conflicts, merge with rebase. Use when ready to create a PR or when working with git branches and upstream.

Sby Skills Guide Bot
DevelopmentIntermediate
6/2/2026
Claude Code
#git#pull-requests#rebase#workflow#collaboration

Recommended for

Automated summary

Handles advanced Git operations such as creating pull requests, rebasing branches, and resolving conflicts to contribute to upstream repositories.

Strengths

  • Automates updating and rebasing before PR creation
  • Supports both forks and direct branch workflows on the main repo
  • Includes conflict resolution steps with clear instructions

Limitations

  • Requires the user to have configured upstream and origin remotes
  • Complex rebase conflicts may still require manual intervention
  • Assumes changes are already committed locally
When to use it

When you need to create a pull request to an upstream repository after working on a branch or fork.

When not to use it

For simple commits directly to main on a personal repository where no PR workflow is needed.

Security analysis

Caution
Quality score88/100

The skill describes a standard git collaboration workflow including branching, rebasing, pushing, and creating pull requests. While the commands themselves are not destructive or obfuscated, they involve network operations (git push, fetch) that could potentially expose data if the remote is malicious, and force push with lease can overwrite remote branches. The skill includes a guardrail to wait for user confirmation before pushing or creating PRs, reducing risk.

Findings
  • •Uses git push with --force-with-lease, which can overwrite remote history if misapplied.
  • •Instructs reading configuration from a local file (.claude-workspace), but no exfiltration risk.
How this analysis is made

Examples

Create a PR from a fork
Create a pull request from my fork to the upstream repository for the pattern I just committed.
Rebase feature branch before PR
Update my current branch with the latest changes from upstream main and rebase before creating a pull request.

name: git-workflow description: > Git operations and pull request workflows. Create PRs, rebase branches, resolve conflicts, merge to upstream. Use when ready to create PR or when working with git branches and upstream.

Git Workflow

Committing Work

cd ~/Code/community-patterns

git add patterns/$GITHUB_USER/pattern.tsx
git commit -m "Add pattern: description"
git push origin main

Getting Updates (Already done in Step 1)

git fetch upstream
git pull --rebase upstream main
git push origin main

Sharing Work Upstream (Creating Pull Requests)

IMPORTANT: Wait for user to tell you to create a PR. Don't push or create PRs automatically.

Before creating any PR, you MUST update from main and rebase your branch:

Step 0: Update and Rebase Before Creating PR

Use cached repository type from workspace config:

# Read IS_FORK from .claude-workspace (set during Step 2)
IS_FORK=$(grep "^is_fork=" .claude-workspace | cut -d= -f2)

# Determine which remote to use
if [ "$IS_FORK" = "true" ]; then
  echo "Working on fork - will fetch from upstream"
  MAIN_REMOTE="upstream"
else
  echo "Working on main repo - will fetch from origin"
  MAIN_REMOTE="origin"
fi

Then fetch latest main and rebase your branch:

# Fetch latest main
git fetch $MAIN_REMOTE

# Rebase current branch on top of main
git rebase $MAIN_REMOTE/main

# If rebase succeeds, push (force-with-lease if on feature branch)
if [ "$(git branch --show-current)" != "main" ]; then
  git push origin $(git branch --show-current) --force-with-lease
else
  git push origin main
fi

If rebase has conflicts:

  1. Show conflict files: git status
  2. Help resolve conflicts
  3. Continue: git rebase --continue
  4. Then push

Why this matters:

  • Ensures your PR is based on the latest main
  • Avoids merge conflicts during PR review
  • Makes PR review easier

If User Has Their Own Fork (Most Common)

When user wants to contribute patterns from their fork to upstream:

Step 1: Ensure changes are committed and pushed to their fork

cd ~/Code/community-patterns
git status  # Verify all changes are committed
git push origin main

Step 2: Update and rebase (see Step 0 above)

Step 3: Create pull request to upstream

gh pr create \
  --repo jkomoros/community-patterns \
  --title "Add: pattern name" \
  --body "$(cat <<'EOF'
## Summary
- Brief description of the pattern
- Key features
- Use cases

## Testing
- [x] Pattern compiles without errors
- [x] Tested in browser at http://localhost:8000
- [x] All features working as expected

🤖 Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"

If Working Directly on jkomoros/community-patterns

CRITICAL: When working directly on the upstream repository, you MUST use branches and PRs. Direct pushes to main are NOT allowed.

Step 1: Create feature branch

cd ~/Code/community-patterns
git checkout -b username/feature-name

Step 2: Commit and push branch

git add patterns/$GITHUB_USER/
git commit -m "Add: pattern name"
git push origin username/feature-name

Step 3: Update and rebase (see Step 0 above)

Step 4: Create pull request

gh pr create \
  --title "Add: pattern name" \
  --body "$(cat <<'EOF'
## Summary
- Brief description

## Testing
- [x] Tested and working

🤖 Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"

Step 5: Merge with rebase (when approved)

gh pr merge PR_NUMBER --rebase --delete-branch

Important Notes

  • Always wait for user permission before creating PRs
  • All PRs are merged with --rebase (NOT --squash or --merge)
  • This preserves individual commit history
  • Commit frequently locally, but only create PR when user asks
  • PRs will be reviewed before merging to upstream
  • After merge, everyone gets your patterns automatically on next update

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/git-workflow-mm5t89vr/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/git-workflow-mm5t89vr' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/git-workflow-mm5t89vr/download' --output '.skill-downloads/git-workflow-mm5t89vr/SKILL.md.part' && mv '.skill-downloads/git-workflow-mm5t89vr/SKILL.md.part' '.skill-downloads/git-workflow-mm5t89vr/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/git-workflow-mm5t89vr/SKILL.md' && test -s '.skill-downloads/git-workflow-mm5t89vr/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/git-workflow' && cp -R '.skill-downloads/git-workflow-mm5t89vr' '.claude/skills/git-workflow'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/git-workflow-mm5t89vr'

openskills read 'git-workflow-mm5t89vr'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/git-workflow-mm5t89vr/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills