/git-env
Create development environments with git worktrees, branches, commits, and push to remote. Auto-applies for git workflow tasks.
$ npx -y skills add openshift/hypershift --skill git-env --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/git-env
Context preview
The summary Claude sees to decide when to auto-load this skill.
Create development environments with git worktrees, branches, commits, and push to remote. Auto-applies for git workflow tasks.
SKILL.md
git-env.SKILL.mdname: Git Environment
description: "Create development environments with git worktrees, branches, commits, and push to remote. Auto-applies for git workflow tasks."
Git Development Environment Workflow
Automates common git development workflows for HyperShift including worktree creation, branching, committing (with proper format), and pushing to remotes.
Configuration
Load environment variables from `dev/claude-env.sh`:
source dev/claude-env.sh
Environment Variables
| Variable | Default | Description | |----------|---------|-------------| | `GIT_FORK_REMOTE` | `enxebre` | Your fork remote name | | `GIT_UPSTREAM_REMOTE` | `origin` | Upstream remote (openshift/hypershift) | | `GIT_BASE_BRANCH` | `main` | Base branch for new features |
Workflows
Create New Development Environment
**With worktree (parallel development):**
# Fetch latest
git fetch $GIT_UPSTREAM_REMOTE $GIT_BASE_BRANCH
# Create worktree with new branch
git worktree add -b <branch-name> <worktree-path> $GIT_UPSTREAM_REMOTE/$GIT_BASE_BRANCH
# Example:
git worktree add -b feat/privatelink-karpenter ../hs-privatelink $GIT_UPSTREAM_REMOTE/$GIT_BASE_BRANCH
**Without worktree (same repo):**
# Fetch latest
git fetch $GIT_UPSTREAM_REMOTE $GIT_BASE_BRANCH
# Create and checkout new branch
git checkout -b <branch-name> $GIT_UPSTREAM_REMOTE/$GIT_BASE_BRANCH
# Example:
git checkout -b fix/bug-123 $GIT_UPSTREAM_REMOTE/$GIT_BASE_BRANCH
Branch Naming Conventions
Use conventional prefixes:
- `feat/<description>` - New features
- `fix/<description>` - Bug fixes
- `docs/<description>` - Documentation
- `refactor/<description>` - Code refactoring
- `test/<description>` - Test additions
- `chore/<description>` - Maintenance tasks
Commit Changes
**Always follow the git-commit-format skill for commits.**
1. **Stage changes:**
git add <specific-files>
2. **Check what's staged:**
git status
git diff --cached
3. **Commit with proper format:**
git commit -m "$(cat <<'EOF'
<type>(<scope>): <description>
[optional body]
Signed-off-by: <name> <email>
Commit-Message-Assisted-by: Claude (via Claude Code)
EOF
)"
4. **Validate commit message:**
make run-gitlint
Push to Remote
**First push (set upstream):**
git push -u $GIT_FORK_REMOTE <branch-name>
**Subsequent pushes:**
git push
**Force push (after rebase):**
# Always use --force-with-lease for safety
git push --force-with-lease
Sync with Upstream
# Fetch latest from upstream
git fetch $GIT_UPSTREAM_REMOTE $GIT_BASE_BRANCH
# Rebase current branch on base branch
git rebase $GIT_UPSTREAM_REMOTE/$GIT_BASE_BRANCH
# If conflicts, resolve them, then:
git rebase --continue
# Push updated branch (force required after rebase)
git push --force-with-lease
Cleanup Worktree
# Remove the worktree
git worktree remove <worktree-path>
# Optionally delete the branch
git branch -D <branch-name>
# Prune stale worktree references
git worktree prune
List Worktrees
git worktree list
Quick Reference Commands
| Task | Command | |------|---------| | New worktree + branch | `git worktree add -b <branch> <path> $GIT_UPSTREAM_REMOTE/$GIT_BASE_BRANCH` | | New branch (no worktree) | `git checkout -b <branch> $GIT_UPSTREAM_REMOTE/$GIT_BASE_BRANCH` | | Stage all changes | `git add -A` | | Stage specific files | `git add <file1> <file2>` | | Check status | `git status` | | View staged diff | `git diff --cached` | | Commit | `git commit -m "<message>"` | | Validate commit | `make run-gitlint` | | Push (first time) | `git push -u $GIT_FORK_REMOTE <branch>` | | Push | `git push` | | Force push (safe) | `git push --force-with-lease` | | Sync with upstream | `git fetch $GIT_UPSTREAM_REMOTE $GIT_BASE_BRANCH && git rebase $GIT_UPSTREAM_REMOTE/$GIT_BASE_BRANCH` | | Remove worktree | `git worktree remove <path>` | | Delete branch | `git branch -D <branch>` | | List worktrees | `git worktree list` |
Example Full Workflow
# 0. Load environment
source dev/claude-env.sh
# 1. Create new feature environment
git fetch $GIT_UPSTREAM_REMOTE $GIT_BASE_BRANCH
git worktree add -b feat/aws-privatelink-subnets ../hs-privatelink $GIT_UPSTREAM_REMOTE/$GIT_BASE_BRANCH
cd ../hs-privatelink
# 2. Make changes...
# ... edit files ...
# 3. Stage and commit
git add -A
git commit -m "$(cat <<'EOF'
feat(aws): add dynamic subnet discovery for privatelink
Implement subnet discovery from Karpenter EC2NodeClass resources
to ensure PrivateLink VPC Endpoints have ENIs in all required
availability zones.
Signed-off-by: Alberto Garcia <agarcia@redhat.com>
Commit-Message-Assisted-by: Claude (via Claude Code)
EOF
)"
# 4. Validate
make run-gitlint
# 5. Push to fork
git push -u $GIT_FORK_REMOTE feat/aws-privatelink-subnets
# 6. Create PR via gh cli
gh pr create --title "feat(aws): add dynamic subnet discovery for privatelink" --body "..."
# 7. After PR merged, cleanup
cd ../hypershift
git worktree remove ../hs-privatelink
git branch -D feat/aws-privatelink-subnets
Notes
- Always use `--force-with-lease` instead of `--force` for safety
- Worktrees allow parallel development on multiple features
- Each worktree shares the same git repository but has its own working directory
- Run `git remote -v` to verify remote configuration
- Configure your fork remote in `dev/claude-env.sh` by setting `GIT_FORK_REMOTE`
Read more
name: Git Environment description: "Create development environments with git worktrees, branches, commits, and push to remote. Auto-applies for git workflow tasks."
Git Development Environment Workflow
Automates common git development workflows for HyperShift including worktree creation, branching, committing (with proper format), and pushing to remotes.
Configuration
Load environment variables from `dev/claude-env.sh`:
source dev/claude-env.sh
Environment Variables
| Variable | Default | Description | |----------|---------|-------------| | `GIT_FORK_REMOTE` | `enxebre` | Your fork remote name | | `GIT_UPSTREAM_REMOTE` | `origin` | Upstream remote (openshift/hypershift) | | `GIT_BASE_BRANCH` | `main` | Base branch for new features |
Workflows
Create New Development Environment
**With worktree (parallel development):**
# Fetch latest git fetch $GIT_UPSTREAM_REMOTE $GIT_BASE_BRANCH # Create worktree with new branch git worktree add -b <branch-name> <worktree-path> $GIT_UPSTREAM_REMOTE/$GIT_BASE_BRANCH # Example: git worktree add -b feat/privatelink-karpenter ../hs-privatelink $GIT_UPSTREAM_REMOTE/$GIT_BASE_BRANCH
**Without worktree (same repo):**
# Fetch latest git fetch $GIT_UPSTREAM_REMOTE $GIT_BASE_BRANCH # Create and checkout new branch git checkout -b <branch-name> $GIT_UPSTREAM_REMOTE/$GIT_BASE_BRANCH # Example: git checkout -b fix/bug-123 $GIT_UPSTREAM_REMOTE/$GIT_BASE_BRANCH
Branch Naming Conventions
Use conventional prefixes:
- `feat/<description>` - New features
- `fix/<description>` - Bug fixes
- `docs/<description>` - Documentation
- `refactor/<description>` - Code refactoring
- `test/<description>` - Test additions
- `chore/<description>` - Maintenance tasks
Commit Changes
**Always follow the git-commit-format skill for commits.**
1. **Stage changes:**
git add <specific-files>
2. **Check what's staged:**
git status git diff --cached
3. **Commit with proper format:**
git commit -m "$(cat <<'EOF' <type>(<scope>): <description> [optional body] Signed-off-by: <name> <email> Commit-Message-Assisted-by: Claude (via Claude Code) EOF )"
4. **Validate commit message:**
make run-gitlint
Push to Remote
**First push (set upstream):**
git push -u $GIT_FORK_REMOTE <branch-name>
**Subsequent pushes:**
git push
**Force push (after rebase):**
# Always use --force-with-lease for safety git push --force-with-lease
Sync with Upstream
# Fetch latest from upstream git fetch $GIT_UPSTREAM_REMOTE $GIT_BASE_BRANCH # Rebase current branch on base branch git rebase $GIT_UPSTREAM_REMOTE/$GIT_BASE_BRANCH # If conflicts, resolve them, then: git rebase --continue # Push updated branch (force required after rebase) git push --force-with-lease
Cleanup Worktree
# Remove the worktree git worktree remove <worktree-path> # Optionally delete the branch git branch -D <branch-name> # Prune stale worktree references git worktree prune
List Worktrees
git worktree list
Quick Reference Commands
| Task | Command | |------|---------| | New worktree + branch | `git worktree add -b <branch> <path> $GIT_UPSTREAM_REMOTE/$GIT_BASE_BRANCH` | | New branch (no worktree) | `git checkout -b <branch> $GIT_UPSTREAM_REMOTE/$GIT_BASE_BRANCH` | | Stage all changes | `git add -A` | | Stage specific files | `git add <file1> <file2>` | | Check status | `git status` | | View staged diff | `git diff --cached` | | Commit | `git commit -m "<message>"` | | Validate commit | `make run-gitlint` | | Push (first time) | `git push -u $GIT_FORK_REMOTE <branch>` | | Push | `git push` | | Force push (safe) | `git push --force-with-lease` | | Sync with upstream | `git fetch $GIT_UPSTREAM_REMOTE $GIT_BASE_BRANCH && git rebase $GIT_UPSTREAM_REMOTE/$GIT_BASE_BRANCH` | | Remove worktree | `git worktree remove <path>` | | Delete branch | `git branch -D <branch>` | | List worktrees | `git worktree list` |
Example Full Workflow
# 0. Load environment source dev/claude-env.sh # 1. Create new feature environment git fetch $GIT_UPSTREAM_REMOTE $GIT_BASE_BRANCH git worktree add -b feat/aws-privatelink-subnets ../hs-privatelink $GIT_UPSTREAM_REMOTE/$GIT_BASE_BRANCH cd ../hs-privatelink # 2. Make changes... # ... edit files ... # 3. Stage and commit git add -A git commit -m "$(cat <<'EOF' feat(aws): add dynamic subnet discovery for privatelink Implement subnet discovery from Karpenter EC2NodeClass resources to ensure PrivateLink VPC Endpoints have ENIs in all required availability zones. Signed-off-by: Alberto Garcia <agarcia@redhat.com> Commit-Message-Assisted-by: Claude (via Claude Code) EOF )" # 4. Validate make run-gitlint # 5. Push to fork git push -u $GIT_FORK_REMOTE feat/aws-privatelink-subnets # 6. Create PR via gh cli gh pr create --title "feat(aws): add dynamic subnet discovery for privatelink" --body "..." # 7. After PR merged, cleanup cd ../hypershift git worktree remove ../hs-privatelink git branch -D feat/aws-privatelink-subnets
Notes
- Always use `--force-with-lease` instead of `--force` for safety
- Worktrees allow parallel development on multiple features
- Each worktree shares the same git repository but has its own working directory
- Run `git remote -v` to verify remote configuration
- Configure your fork remote in `dev/claude-env.sh` by setting `GIT_FORK_REMOTE`
HyperShift is a middleware for hosting OpenShift control planes at scale that solves for cost and time to provision, as well as portability cross cloud with strong separation of concerns between management and workloads.
Repo: openshift/hypershift
Other skills on hypershift.
- /create-cpo-override
Interactively create CPO image overrides — resolves images, verifies fixes, edits overrides.yaml, and prepares a PR
Open skill - /debug-cluster
Provides systematic debugging approaches for HyperShift hosted-cluster issues. Auto-applies when debugging cluster problems, investigating stuck deletions, or troubleshooting control plane issues.
Open skill - /build-cpo-image
Build and push control-plane-operator container image. Auto-applies when testing CPO changes that require deploying to a live cluster.
Open skill - /build-ho-image
Build and push hypershift-operator container image. Auto-applies when testing HO changes that require deploying to a live cluster.
Open skill - /create-hc-aws
Create a HyperShift HostedCluster on AWS for development and testing, with optional custom CPO/HO images.
Open skill - /destroy-hc-aws
Destroy a HyperShift HostedCluster and all associated AWS infrastructure (VPC, IAM, Route53, etc.).
Open skill

