Commit 27e243b
fix: fall back to FETCH_HEAD when gh pr checkout fails for branch names with / (#3232)
* fix: fall back to FETCH_HEAD checkout when gh pr checkout fails for branch names with /
Fixes #3231
gh pr checkout internally runs `git checkout -b <branch> --track origin/<branch>`.
When the branch name contains `/`, git cannot resolve the tracking ref inside a
freshly created detached worktree, producing "starting point is not a branch".
The fetch succeeds — only the tracking setup fails. Catch that specific error and
fall back to `git checkout -b <localBranchName> --no-track FETCH_HEAD`.
push.autoSetupRemote=true (already set after worktree creation) handles push
tracking without needing --track.
* fix: use -B flag to force-replace branch in FETCH_HEAD fallback checkout
* fix: log fallback path when gh pr checkout fails with tracking error
---------
Co-authored-by: Ruan Gustavo Araujo da Silveira <ruan.silveira@M4Pro.local>1 parent 1b2fe39 commit 27e243b
1 file changed
Lines changed: 39 additions & 12 deletions
Lines changed: 39 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1777 | 1777 | | |
1778 | 1778 | | |
1779 | 1779 | | |
1780 | | - | |
1781 | | - | |
1782 | | - | |
1783 | | - | |
1784 | | - | |
1785 | | - | |
1786 | | - | |
1787 | | - | |
1788 | | - | |
1789 | | - | |
1790 | | - | |
1791 | | - | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
1792 | 1819 | | |
1793 | 1820 | | |
1794 | 1821 | | |
| |||
0 commit comments