Hello, I am in this situation: - I have a stack wi...
# how-do-i
g
Hello, I am in this situation: • I have a stack with multiple branches,
branch-a
,
branch-b
,
branch-c
• I am checkout to
branch-b
which has 2 commits,
commit-2a
and
commit-2b
• I have staged changes and I want to add them to the first commit
commit-2a
but the last commit is
commit-2b
Is there a way to do it with the Graphite CLI, maybe using the
gt modify
command? How? Thank you!
✅ 1
p
(If applicable) To help us more clearly understand what you're trying to do, please provide additional details about: - Screenshots / debug logs / list of commands you've tried to run so far - Your workflow - Current state
hey Gabriele,
gt
doesn't directly support amending staged changes into a specific commit within a branch. However, there are two commands to consider for approximating what you're trying: 1.
gt absorb
— This automatically figures out which commit your changes belong to based on the lines you modified. Run
gt absorb -a
and it will attempt to amend each hunk into the correct commit (like
commit-2a
). It will show you a preview before applying. 2.
gt modify --interactive-rebase
— This starts a
git interactive rebase
on the commits in your branch, where you can manually reorder, squash, or fixup commits to fold your changes into
commit-2a
.
gt absorb
is the most seamless approach if your changes touch the same lines as
commit-2a
. See more in our docs: Working with commits
g
I tried
gt absorb
but some changes got left out. I'll try
gt modify --interactive-rebase
. Thank you!