I’m still new to git, so bear with me. I started adding a feature to my project in my current branch and committed it, then found out that I needed to add a more important feature first. (If I had thought about it, I would have just put the new feature into another branch but alas – hindsight is 20/20.)
I want to go back to my previous commit, add the more important feature and then add the less important feature that I already committed. Any ideas?
Thanks in advance.
That mean rewriting the commit history of your branch, which is possible (practical) only if you do not have already pushed said branch to another repo.
If you do not pushed that branch, you have:
Mark it as branch F1
Reset your current branch to before F1
Make your Feature 0 F0 (the one that should have been done before F1)
Rebase F1 branch on top of current branch
If you did already pushed that feature, some revert is in order (see Diego’s answer)