finish-feature

otrebu's avatarfrom otrebu

Complete feature work and merge back to main branch. Use when user wants to finish a feature, close a feature, or merge feature branch. Switches to main, pulls latest changes, merges feature branch, and pushes to remote.

⭐0stars🔀0forks📁View on GitHub🕐Updated Nov 18, 2025

When & Why to Use This Skill

The 'finish-feature' skill automates the end-to-end Git workflow for merging completed feature branches into the main codebase. It streamlines repetitive version control tasks—including branch switching, pulling latest updates, merging, and remote pushing—while ensuring safety through pre-merge checks and conflict management, significantly reducing manual errors in the development lifecycle.

Use Cases

  • Automating the final integration of a completed feature into the main branch to ensure a consistent and error-free deployment path.
  • Maintaining repository hygiene by safely deleting local and remote feature branches immediately after a successful merge.
  • Preventing integration conflicts by enforcing a 'pull-before-merge' workflow, ensuring the local main branch is synchronized with the remote origin before merging new code.
namefinish-feature
descriptionComplete feature work and merge back to main branch. Use when user wants to finish a feature, close a feature, or merge feature branch. Switches to main, pulls latest changes, merges feature branch, and pushes to remote.
allowed-toolsBash(git add:*), Bash(git status:*), Bash(git commit:*), Bash(git diff:*), Bash(git log:*), Bash(git branch:*), Bash(git push:*), Bash(git pull:*), Bash(git merge:*), Bash(git checkout:*), Bash(git stash:*), Bash(git tag:*)

Finish Feature

Process

1. Verify Current Branch

Run git branch --show-current:

  • If main/master: Ask which feature branch to merge
  • If feature branch: Confirm this branch

2. Check Working Directory

Run git status:

  • Uncommitted changes? Ask: commit or stash?
  • Clean? Proceed

3. Store Feature Branch Name

FEATURE_BRANCH=$(git branch --show-current)

4. Switch to Main

Determine main branch (git branch --list main master), then:

git checkout main  # or master

5. Pull Latest

git pull origin main  # or master

6. Merge Feature Branch

git merge $FEATURE_BRANCH

Conflicts? List files via git status, wait for user resolution: git add . + git commit

7. Push

git push origin main  # or master

8. Delete Feature Branch?

Ask user:

Local:

git branch -d $FEATURE_BRANCH

Remote:

git push origin --delete $FEATURE_BRANCH

9. Confirm Completion

Output:

  • Merged branch: <feature-branch-name>
  • Push status
  • Deletion status (if applicable)

Constraints

  • Pull main before merge
  • Verify clean working dir before branch switch
  • Never force push to main
  • User resolves conflicts
  • Always ask before deleting branches

Example

User: "Finish user-auth feature"

  1. On feature/user-auth, git status clean
  2. git checkout main && git pull origin main
  3. git merge feature/user-auth && git push origin main
  4. Ask: Delete branch? → User confirms
  5. Output: "Feature 'user-auth' merged to main, pushed, branch deleted"