|
46 | 46 |
|
47 | 47 | <tool name="gh pr checkout"> |
48 | 48 | <best_practices> |
49 | | - <practice>Always use --force flag to avoid interactive branch selection.</practice> |
50 | | - <practice>Format: 'gh pr checkout <pr_number> --force'</practice> |
51 | | - <practice>If gh checkout fails, fallback to git fetch + checkout pattern.</practice> |
| 49 | + <practice>Use --force flag: 'gh pr checkout <pr_number> --force'</practice> |
| 50 | + <practice>If gh checkout fails, use: git fetch origin pull/<pr_number>/head:<branch_name></practice> |
52 | 51 | </best_practices> |
53 | | - <non_interactive_alternatives> |
54 | | - <alternative>git fetch origin pull/<pr_number>/head:<branch_name></alternative> |
55 | | - <alternative>git checkout <branch_name></alternative> |
56 | | - </non_interactive_alternatives> |
57 | 52 | </tool> |
58 | 53 |
|
59 | 54 | <tool name="git operations"> |
60 | 55 | <best_practices> |
61 | 56 | <practice>Use --force-with-lease for safer force pushing.</practice> |
62 | | - <practice>Check git status programmatically with --porcelain flag.</practice> |
63 | | - <practice>Use git rebase --dry-run to detect conflicts before attempting rebase.</practice> |
| 57 | + <practice>Use GIT_EDITOR=true to prevent interactive prompts during rebases.</practice> |
64 | 58 | <practice>Always determine the correct remote before pushing (origin vs fork).</practice> |
65 | 59 | </best_practices> |
66 | 60 | <remote_handling> |
67 | 61 | <step>Check if PR is from a fork: 'gh pr view <pr_number> --json isCrossRepository'</step> |
68 | | - <step>If isCrossRepository is true, the PR is from a fork</step> |
69 | | - <step>For fork PRs, check if fork remote exists: 'git remote -v'</step> |
70 | | - <step>If fork remote doesn't exist, add it: 'git remote add fork https://github.com/<fork_owner>/<repo>.git'</step> |
| 62 | + <step>If isCrossRepository is true, add fork remote if needed</step> |
71 | 63 | <step>Push to appropriate remote: 'git push --force-with-lease <remote> <branch>'</step> |
72 | 64 | </remote_handling> |
73 | 65 | <conflict_resolution> |
74 | | - <step>Use 'git rebase --dry-run main' to detect conflicts</step> |
75 | | - <step>If conflicts detected, resolve manually via file editing</step> |
76 | | - <step>Use 'git status --porcelain' to identify conflicted files</step> |
77 | | - <step>Edit files to resolve conflicts, removing conflict markers</step> |
78 | | - <step>Use 'git add .' and commit the resolved changes</step> |
| 66 | + <step>Use 'GIT_EDITOR=true git rebase main' to start rebase</step> |
| 67 | + <step>If conflicts occur, edit files to resolve them</step> |
| 68 | + <step>Use 'git add .' and 'git rebase --continue' to proceed</step> |
79 | 69 | </conflict_resolution> |
80 | 70 | </tool> |
81 | 71 |
|
|
0 commit comments