HOW TO Amend files in older commit #21623
-
I have a local branch, not merged or pushed to github. I made successive changes to the branch with non-overlapping commit items. Branch->HEAD: File 3 I found an issue in File 1 and edited it. Can I somehow use Since this is only a local branch, not pushed, I don’t care about the commit history being changed. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
See Git - Rewriting History for a lot more details. 🙂 |
Beta Was this translation helpful? Give feedback.
-
EDIT: Just read your link. Looks like that will do the trick. Thank you. Will post update. After that, how do I return to the current HEAD? Are the following changes preserved? Rebase had always made me nervous :slight_smile: Thanks |
Beta Was this translation helpful? Give feedback.
-
I committed the change to be merged with HEAD~2. Did the |
Beta Was this translation helpful? Give feedback.
git rebase -i HEAD~3
is probably what you’re looking for. The base commit for the rebase must be the parent of the first one you want to edit. The option-i
(short for--interactive
) lets you choose what to do to each commit since, withedit
being one option.See Git - Rewriting History for a lot more details. 🙂