M
M
mrSeller2019-05-18 02:32:14
git
mrSeller, 2019-05-18 02:32:14

How to apply changes to NOT the latest commit?

There is a branch and three commits in it AAA-BBB-CCC
All commits were sent to PR
Next, edits were made, but they need to be applied to the BBB commit
If I needed to merge them from CCC, I would use --amend, but what about in my situation?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2019-05-18
@jcmvbkbc

There is a branch and three commits in it AAA-BBB-CCC ...
Next, edits were made, but they need to be applied to the BBB commit

git commit -a -m fixes
git rebase -i AAA

move fixes after BBB, replacepick before fixes with fix.
Everything is the same, but automatically:
git commit -a --fixup BBB
git rebase --autosquash AAA

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question