Skip to content
Back to skills

Git Push Workflow

ASecurity

This skill should be used when the user says "push", "push to remote", "create PR", "create MR", "pull request", "merge request", "open PR", or when committing and pushing code to GitHub or GitLab. Covers git workflow rules, branch naming conventions, commit message format, and the push + PR/MR creation procedure.

  • 6 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added October 4, 2026
developmentbashrefactoringgitdocumentation

Security analysis

A100/100

Scanned October 4, 2026

npx -y skills add aishajv/claude-everything --skill git-push-workflow --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Git Push Workflow?

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

Security grade badge for Git Push Workflow
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aishajv-git-push-workflow/badge)](https://www.skillsdirectory.com/skills/aishajv-git-push-workflow)

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-push-workflow
description: This skill should be used when the user says "push", "push to remote", "create PR", "create MR", "pull request", "merge request", "open PR", or when committing and pushing code to GitHub or GitLab. Covers git workflow rules, branch naming conventions, commit message format, and the push + PR/MR creation procedure.
allowed-tools: Bash(git *), Bash(gh pr create *), Bash(glab mr update *)
model: haiku
---

# /git-push-workflow

## Critical Constraints

- **NEVER work directly on `main`** — always create a feature branch first
- **NEVER force push to `main`**
- **NEVER merge to `main` yourself** — always use a pull request (GitHub) or merge request (GitLab)

## Branch Naming

- `feature/*` — new features
- `fix/*` — bug fixes
- `chore/*` — maintenance tasks (dependencies, config)
- `refactor/*` — code refactoring
- `docs/*` — documentation only

## Branch Workflow

1. `git checkout main && git pull origin main`
2. `git checkout -b <type>/branch-name`
3. Make changes, commit as needed
4. When ready, follow the push steps below

## Commit message format

```
<type>: <subject>
```

- **Types:** `feat`, `fix`, `chore`, `refactor`, `docs`, `test`
- Keep subjects under 50 characters, imperative mood ("add" not "added")

## Steps

1. **Detect remote platform** — run `git remote get-url origin`:
   - If `origin` is not configured, stop and ask the user to set up the `origin` remote before continuing.
   - If URL contains `github.com` → GitHub (use `gh pr` for PR creation)
   - If URL contains `gitlab.com` (or your self-hosted GitLab instance) → GitLab (use `glab mr` for MR creation)

2. **Stage and commit** (if there are uncommitted changes):
   - Stage relevant files — never stage `.env`, credentials, or secrets
   - If no uncommitted changes, skip to step 3

3. **Squash all branch commits into one:**
   - `git fetch origin main`
   - Count commits ahead of `origin/main`: `git rev-list --count origin/main..HEAD`
   - If more than one commit: find where the branch started with `git merge-base HEAD origin/main`, then run `git reset --soft <that commit>` and `git commit` with the final message
   - If exactly one commit: skip squash

4. **Rebase on latest main:**
   - `git rebase origin/main`
   - Resolve any conflicts. Only ping the user if you're unsure how to resolve a specific conflict; otherwise resolve and continue.

5. **Push and create PR/MR:**
   - **GitHub:** `git push origin HEAD --force-with-lease`, then `gh pr create --base main --title "<commit subject>" --body "<commit body or summary>"`
   - **GitLab:** `git push origin HEAD -o merge_request.create -o merge_request.target=main --force-with-lease` (creates the MR via push options in one command)

6. **Set PR/MR title** to match the squashed commit message:
   - **GitHub:** title is set during `gh pr create` (step 5) — nothing more to do
   - **GitLab:** `glab mr update <MR_NUMBER> --title "<commit subject line>"`

7. **Report the PR/MR URL** from the push output (GitLab) or the `gh pr create` output (GitHub).

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.