Skip to content

Instantly share code, notes, and snippets.

@achantavy
Created November 10, 2025 22:28
Show Gist options
  • Select an option

  • Save achantavy/876090bbe8273504ea8279700c0a841f to your computer and use it in GitHub Desktop.

Select an option

Save achantavy/876090bbe8273504ea8279700c0a841f to your computer and use it in GitHub Desktop.
# Option 1: for forks
git rev-parse --is-bare-repository
# must return 'true' for this to work
CONTRIB_USER=github_username_goes_here
CONTRIB_BRANCH=pr_branch_name_goes_here # the stuff right of the ':'
git remote add $CONTRIB_USER [email protected]:${CONTRIB_USER}/cartography.git
git fetch $CONTRIB_USER
LOCAL_REF=pr_${CONTRIB_USER}_${CONTRIB_BRANCH}
git fetch $CONTRIB_USER $CONTRIB_BRANCH:$LOCAL_REF
git worktree add ~/src/cartography/$LOCAL_REF $LOCAL_REF
cd $LOCAL_REF
# Run claude, ask it stuff about the PR
#------------------------------
# Option 2: For non-forks
git rev-parse --is-bare-repository
# must return 'true' for this to work
CONTRIB_BRANCH=pr_branch_name_goes_here
LOCAL_REF=pr_origin_${CONTRIB_BRANCH}
git fetch origin $CONTRIB_BRANCH:$LOCAL_REF
git worktree add ~/src/cartography/$LOCAL_REF $LOCAL_REF
cd ~/src/cartography/$LOCAL_REF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment