Sometimes I have a branch with multiple commits an...
# how-do-i
s
Sometimes I have a branch with multiple commits and I’d like to remove a commit from the PR but keep the diff. While sometimes I will make a branch with the new diff, sometimes it’s not really worthy of a branch so I just stash it. My current workflow for this doesn’t play nicely with graphite. Suppose I have a stack with branch
B2
stacked on
B1
, with
B1
having some commit X that I want to remove and stash. This is what I do: •
gt branch edit
on
B1
, move
X
to the tip of
B1
•
git reset HEAD~1
to roll back to the previous commit with the
X
diff loaded into the index •
git stash
• checkout
B2
and
gt stack restack
The problem with this is that graphite is not aware that
X
has been removed from
B1
, and so it now thinks
X
is part of
B2
. When I go to restack
B2
on
B1
I first need to
gt branch edit
B2
and drop
X
, which has now become the base commit of
B2
. If I forget to do this I end up with rebase pain. Is there a better graphite-recommended workflow for this functionality?