Most of the times, when PR is not trivial in scope and size, Web UI can often lead to loosing focus and context while scrolling down through the blog of changes. It’s way more efficient to go through the code in the IDE.
I got tired of stashing changes, creating "wip" commints and shuffling branches.
And so this workflow was born.
-
Leverages git worktree to have multiple branches within the same cloned repo
-
Relies on GH CLI for dealing with PR branches
-
Uses simple git hook to populate common project settings into new PR directory (optional)
-
I use this to add my
.autoenv
,tools-version
and other git-ignored utilities, so I have consistent set up across the PRs without manual steps.
git config --global alias.worktree-add-pr "!f() { gh pr checkout $1 -b pr-$1; git co -; git worktree-add pr-$1; }; f"
#!/bin/bash
previous_head="$1"
new_head="$2"
checkout_type="$3"
if [ "$previous_head" = "0000000000000000000000000000000000000000" ]; then
echo "Setting up the worktree..."
find ../dev-settings -type f -exec ln -s '{}' . \; // (1)
fi
exit 0
-
folder in the main project directory