Skip to content

Instantly share code, notes, and snippets.

@caffeinum
Created May 26, 2025 19:36
Show Gist options
  • Save caffeinum/ee6ae6c3c776b769b6f5b9029a0a3007 to your computer and use it in GitHub Desktop.
Save caffeinum/ee6ae6c3c776b769b6f5b9029a0a3007 to your computer and use it in GitHub Desktop.

Set up a separate git worktree to solve the issue: $ARGUMENTS.

If this is a number, fetch issue description from Github.

  1. Fetch issue info if number is provided. Use gh issue view ### --comments without specifying repo. It will use default from the dir we're currently in.

  2. Come up with a branch name from the issue description

  3. Create branch git branch "$BRANCH_NAME" main

  4. Find worktrees directory for this project in a parent directory PROJECT=basename $(pwd) mkdir -p ../$PROJECT-worktrees # if it doesnt exist WORKTREE_DIR=../$PROJECT-worktrees/$BRANCH_NAME git worktree add "$WORKTREE_DIR" "$BRANCH_NAME"

  5. Change to the worktree directory cd "$WORKTREE_DIR" echo "Working in $WORKTREE_DIR on branch $BRANCH_NAME to solve: "$ISSUE""

Now solve the issue in this worktree.

  1. Think about the issue. Think if you need anything else to proceed.
  2. Search the codebase for relevant files
  3. Understand the problem described
  4. Implement the necessary changes to fix the issue
  5. Write and run tests to verify the fix
  6. Ensure code passes linting and type checking
  7. Create a descriptive commit message
  8. Push and create a PR

Remember to use the GitHub CLI (gh) for all GitHub-related tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment