# Push

> Guide the push process following Marty conventions - branch pushing, force push safety, remote management, and PR creation. Make sure to use this skill whenever the user asks to push, push changes, push to remote, git push, force push, or create a PR. Also use it when the user says things like "push my code", "push to origin", "I need to push changes", or "create a pull request".

- Skill: `nesalia-inc/push` (Agent Skill)
- Install (CLI): `npx skillmds@latest add nesalia-inc/push`
- Raw SKILL.md: https://api.skillmd.com/api/skills/nesalia-inc/push/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: nesalia-inc (https://skillmd.com/u/nesalia-inc)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/nesalia-inc/push

---


# Push Process Guide (Non-Interactive)

Follow this guide to push code and create pull requests following Marty's workflow. All operations are command-line only — no interactive editors.

## Pre-Push Checklist

Before pushing, ensure:

```bash
# 1. Verify current branch and status
git status

# 2. Check if branch exists on remote
git branch -vv

# 3. Review commits to be pushed
git log --oneline origin/main..HEAD
```

## Push Commands

### Standard Push (New Branch)

```bash
git push -u origin HEAD
```

### Push to Update Existing Branch

```bash
git push
```

### Push with Upstream Setting

```bash
git push --set-upstream origin feat/my-feature
```

## Force Push

**Use only when necessary** — typically for:
- Amending commits that haven't been reviewed
- Rebasing your own feature branches
- Cleaning up WIP commits before PR review

```bash
git push --force-with-lease
```

**Why `--force-with-lease` instead of `--force`:**
- Refuses to push if someone else pushed to the branch
- Safer for shared branches
- Prevents accidental overwriting of others' work

**When NOT to force push:**
- Main/master branches
- Shared branches with active collaboration
- After PR has been approved and is pending merge

## Remote Management

### Check Remotes

```bash
git remote -v
```

### Add Remote

```bash
git remote add origin https://github.com/owner/repo.git
```

### Update Remote URL

```bash
git remote set-url origin https://github.com/owner/repo.git
```

## Creating Pull Requests (Non-Interactive)

After pushing, create PR using `gh`:

```bash
# Create PR with title and body
gh pr create --title "feat(scope): description" --body "Description

Co-Authored-By: martyy-code <nesalia.inc@gmail.com>"

# Create PR from specific branch
gh pr create --base main --head feat/my-feature

# Create PR with reviewer
gh pr create --reviewer username1,username2
```

### PR Body Template

```
## Summary
- What this PR does
- Why this change is needed

## Test Plan
- [ ] Test A
- [ ] Test B

## Related Issues
Closes #123

Co-Authored-By: martyy-code <nesalia.inc@gmail.com>
```

## Handling Push Conflicts

### When Push is Rejected

If push is rejected due to divergence:

```bash
# Fetch and rebase onto latest
git fetch origin && git rebase origin/main

# Or merge (if you prefer a merge commit)
git fetch origin && git merge origin/main
```

### Resolve Conflicts

```bash
# After rebase/merge, resolve conflicts
# Edit conflicted files, then:
git add <resolved-file>
git rebase --continue
# or git merge --continue
```

## Push Verification

After push, verify:

```bash
# Verify remote branch exists
git branch -r

# Verify commit is on remote
git log --oneline -1 origin/HEAD

# Check GitHub status (if using gh)
gh pr status
```

## Common Mistakes to Avoid

1. **Force pushing main/shared branches**: Never do this
2. **Pushing without PR for non-trivial changes**: Always use branches for features/fixes
3. **Missing `-u` on first push**: Ensures tracking is set up correctly
4. **Not verifying push**: Always confirm the push succeeded

## Quick Reference

```
Push new branch:     git push -u origin HEAD
Push update:         git push
Force with lease:    git push --force-with-lease
Create PR:           gh pr create --title "feat: description" --body "..."
Check status:        git status && git branch -vv
```

## Related Skills

| Skill | When to Use |
|-------|-------------|
| `/commit` | Before push, to make proper commits |
| `/sync` | To sync branch with latest main |
