I have a situation, where I accidentally merged a submodule in the super project. I ran the below command from the super project i.e the location of .gitmodules
git pull submodule_dir/submodule_file
Ofcourse, now every commit messages from the submodule is integrated in the super project. I can manually remove the files, because they are just in a folder, but how do I remove all the commits ( they are around 9 in total ) and can also be identified. The problem is that rebase would not work, because the commits are spread across. A rebase for example to HEAD^9 would also remove some of the commits that actually belongs to the superproject.
git reset
, git rebase
wont work. because otherwise, I will loose other commits.
git reset --hard origin/master
is the closest best bet, but it would destroy my local changes that I already commited.
What could be the solution? I have never used cherry pick,, but I am not sure, if I should do it. I wanted to ask before experimenting and make things worse. Something like this and to remove all the culprit commits.
commit latest: this consists of all my local changes and they are precious.
commit
commit
culprit commit
commit
commit
culprit commit
commit
commit
culprit commit
commit
commit
commit
commit