Let’s say I have 2 commits in my git log. Now I want to go back to the first commit and modify some files and add that as the third commit. When I type in git log I want 3 commits to be there on the same branch. git reset --soft firstcommit and then commiting again wipes my second commit. How do I achieve what I want?
Let’s say I have 2 commits in my git log. Now I want to
Share
Suppose you are now at thirdcommit.
You can use
git cherry-pick secondcommitto get it back.And the log will be
If you want the log to be like:
you can do :