I have couple of submodules in my project and I inadvertently made some changes to the modules.
Though I did not explicitly check in the changes, I see the subproject commits when I diff the repository.
(Using stash)
When I do a git status
on my local repo. it showed a (modified content)
against the subproject. So I moved to the subdirectory of the subproject and discarded the changes. When I do a git status now, the (modified content) does not show. However, since there are no commits, I cannot check in or revert the inadvertent commit shown in pic. git revert <green commit hash in pic>
errors out as there is no such commit in my local repo.
Please help me understand how I can revert the commit on my subproject. These commits do not show even when I go into the subdirectory of the subproject.
Not sure if it's the best way, but I found out how to do it.
git checkout -- <file>
git pull origin master
.(new commits)
besides the subproject. Add the subproject
using git add <subproject-name>
and git commit
git push
the changes to the remote repository.