This is a script I wrote to make managing feature branches / merge branches easier.
It's firmly in the "it doesn't exist" -> "make it PoC"
phase of the
"it doesn't exist" -> "make it PoC" -> "make it reliable" -> "make it fast"
progressional system.
I was inspired to build this after trying realyze/pr-train. It works great, but I wanted a fun side-project & also more control over what exactly was happening, so I could do things slightly differently.
- make a branch
new-feature-stub
, add it to your.pr-train.yml
file - save your github token to
~/.graft/token
- run
graft
- make a new branch
new-feature-impl
offnew-feature-stub
, add it to your.pr-train.yml
file after the previous one - make some changes, commit them
- run
graft
again - go back to
new-feature-stub
- make some changes
- run
graft
again - make a new branch
new-feature-cleanup
offnew-feature-impl
- run
graft
yet again - close the PR for
new-feature-impl
on Github - run
graft
once more
- Fetch all branches
- For each branch, merge
origin/{branch}
into{branch}
- Ask if you want to update your first branch with
base
(usuallymain
ormaster
) - Intelligently
graft
(merge) changes in earlier banches through to the tip of your changes - For each branch, push
{branch}
toorigin/{branch}
if needed - Do its best to maintain a PR train with Table-of-Contents and Merge Status
I've tried to make it gracefully handle hiccups as well as it can. Some example hiccups are:
- merge conflicts
- diverging branches
- the sudden addition of a new branch to the middle of the train
- a surprise close/merge of a PR attached to a branch
if you encounter any issues using this tool, please raise an issue describing;
- the exact situation that went wrong
- what you expected to happen, that didn't
- the steps to reproduce it.
- Automated Tests
- Code Cleanliness refactor
- Publish on Homebrew
- Publish on Winget / Chocolatey
- Publish on Snap
- New Features:
- cli to generate new train branches
- cli to generate PR descriptions, using templates
- raycast extension