Skip to content

Instantly share code, notes, and snippets.

Last active February 10, 2023 18:21
What would you like to do?
Code Review Rangiri

Code Review Rangiri


This is part of a broader set of tools used to make it easier to split one large change into many.

Move these two commands into a user-writable bin folder (I personally user ~/bin, but you may prefer /usr/local/bin or similar).


To start dicing, run git set-grab-head <ref-to-full-commit>. Then, as you build out your chain of commits, you can use git grab <file> <file> ... to copy state from the grab head to the local index.


Maintaining a chain of PRs in GitHub is annoying, so I made a utility called git rebase-chain to assist. You can install it with pip install git-rebase-chain.

For more documentation, see

git checkout --no-overlay grab-head $@
git update-ref refs/heads/grab-head ${1:-@}
set -e
if [ "$(git diff-index @)" != "" ] && [ "$1" != "--hard" ]; then
echo "You have uncommitted changes. Please commit them first."
exit 1
BRANCH=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD)
if [ "$BRANCH" = "HEAD" ]; then
echo "You are not on a branch. Please checkout a branch first."
exit 1
git push origin -f @:refs/heads/$BRANCH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment