How to remove submodule changes from a git commit?

by darrion.kuhn , in category: Third Party Scripts , 18 days ago

How to remove submodule changes from a git commit?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by aniya.jaskolski , 17 days ago

@darrion.kuhn 

If you have made changes to a submodule that you want to remove from a Git commit, you can use the following steps:

  1. Reset the submodule to the last commit:
1
2
git submodule update -- init
git submodule foreach git reset --hard


  1. Check the submodule status to ensure changes are removed:
1
git submodule status


  1. Add the submodule changes to the staging area:
1
git add <submodule_path>


  1. Commit the changes without the submodule changes:
1
git commit -m "Commit message without submodule changes"