| name | git-workflow |
| description | Execute safe Git workflows — branching, committing, resolving conflicts, and managing PRs |
Git Workflow
Safe Git operations for branching, committing, conflict resolution, and pull request management.
When to Use
- Creating feature branches and managing commit history
- Resolving merge conflicts
- Preparing and submitting pull requests
- Rebasing or squashing commits
Workflow
1. Branch Creation
git fetch origin
git checkout -b <type>/<short-description> origin/main
Branch naming: feat/, fix/, refactor/, docs/, chore/
2. Commit Patterns
Write atomic commits — one logical change per commit.
git add <file1> <file2>
git commit -m "<type>(<scope>): <description>"
Conventional types: feat, fix, refactor, docs, test, chore
| Do | Don't |
|---|
| One logical change per commit | Bundle unrelated changes |
| Descriptive message explaining "what" | git commit -m "updates" |
| Stage specific files | git add . blindly |
3. Keeping Up to Date
git fetch origin
git rebase origin/main
git add <resolved-files>
git rebase --continue
4. Conflict Resolution
- Read both sides of the conflict carefully
- Understand the intent of each change
- Merge intentionally — never accept "ours" or "theirs" blindly
- Run tests after resolving
5. Pull Request Preparation
git rebase -i origin/main
git push -u origin <branch-name>
git push --force-with-lease
6. PR Checklist
Red Flags
| Signal | Action |
|---|
git push --force on shared branch | Use --force-with-lease |
| Credentials in a commit | Rotate immediately, rewrite history, rerun full-history secret scans |
| 20+ files changed with vague message | Split into logical commits |
| Merge conflict resolved without reading both sides | Re-resolve intentionally |
Related Skills
Backing Guide