I have this list of commits:
The first 2 commits are pretty well and works properly. But I need to remove those 3 commits below without affecting my work(first 2 commits).
Suggestions?
I have this list of commits:
The first 2 commits are pretty well and works properly. But I need to remove those 3 commits below without affecting my work(first 2 commits).
Suggestions?
Since the commits you want are newer, you can't simply checkout to the commit because the previous commits will be there. What I would suggest doing is the following.
0e4e
)git cherry-pick 54d8c0a2
, fix any conflicts, and then run git cherry-pick d108639e
. This will leave you with a branch that is <commit before 0e4e> - 54d8c0a2 - d108639e
You can use git revert
. Revert undoes changes from a specific commit, leaving all other changes untouched. (Revert does not change the old commits themselves; it actually creates a new commit to make its changes. That way, the commit you reverted is still in the repo's history if you ever need it.) For example, run git revert 5816058f
to revert their 'restore rest-defult' commit. See this answer if you want to revert all 3 of their commits with a single commit.