Skip to content

Instantly share code, notes, and snippets.

@chp-io
Forked from nicktoumpelis/repo-rinse.sh
Last active June 17, 2021 20:36
Show Gist options
  • Save chp-io/517f9c93d1fca0b869d1b82e9ab80052 to your computer and use it in GitHub Desktop.
Save chp-io/517f9c93d1fca0b869d1b82e9ab80052 to your computer and use it in GitHub Desktop.
Cleans and resets a git repo and its submodules
#!/bin/sh
git reset --hard
git submodule foreach --recursive 'git reset HEAD . || :'
git submodule foreach --recursive 'git checkout -- . || :'
git submodule update --init --recursive
git clean -d -f -f -x
git submodule foreach --recursive git clean -d -f -f -x
#TODO add submodule filtering argument
# git -c submodule."third-party/repo-name".update=none submodule update --init --recursive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment