Skip to content

Commit 07faba3

Browse files
gisk0chapati23
authored andcommitted
chore: add rebase-only conflict resolution strategy to git workflow rule
1 parent 31a8f10 commit 07faba3

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

.cursor/rules/git-workflow.mdc

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,40 @@ gh pr create --base main --title "..." --body "..."
3434
| `fix/` | Bug fixes |
3535
| `chore/` | Docs, deps, config, refactoring |
3636

37+
## Conflict Resolution: Rebase-Only
38+
39+
When a branch falls behind `main`, **always rebase — never merge**:
40+
41+
```bash
42+
# ❌ Never do this — creates a merge commit that breaks GitHub's rebase button
43+
git merge origin/main
44+
45+
# ✅ Always do this
46+
git fetch origin
47+
git rebase origin/main
48+
```
49+
50+
After rebasing, force-push the branch:
51+
52+
```bash
53+
git push --force-with-lease origin <branch>
54+
```
55+
56+
(`--force-with-lease` aborts safely if someone else pushed to the branch in the meantime.)
57+
58+
## Force Push Policy
59+
60+
| Branch | Force push? |
61+
| --- | --- |
62+
| `main` | ❌ Never |
63+
| Feature branch, after rebase | ✅ Use `--force-with-lease` |
64+
65+
## PR Merge Strategy
66+
67+
Always use **"Rebase and merge"** on GitHub. Never "Create a merge commit".
68+
3769
## Why
3870

3971
CI deploys on push to `main`. Unreviewed changes go straight to production.
4072
PRs give a chance to catch issues before they affect the daily briefing.
73+
Linear history makes `git log` readable and bisecting easy.

0 commit comments

Comments
 (0)