Skip to content

Instantly share code, notes, and snippets.

@rxnlabs
Last active June 23, 2016 16:13
Show Gist options
  • Save rxnlabs/e583c408e1e0d0f9bf70 to your computer and use it in GitHub Desktop.
Save rxnlabs/e583c408e1e0d0f9bf70 to your computer and use it in GitHub Desktop.
Git - resetting changed submodules, updating submodules to the latest commit from the master branch. Easy way to work with Git submodules after changing files or when something goes wrong with trying to update submodules.
git submodule add -b master link_to_git_repo_here_ssh_or_https path_to_clone_git_submodule_to_here
#Remove a submodule from a Git repo
git submodule deinit submodule_name_here && git rm --cached submodule_name_here
#http://stackoverflow.com/questions/10906554/how-do-i-revert-my-changes-to-a-git-submodule#answer-23668025
git pull origin master && git submodule foreach git reset --hard HEAD && git submodule init && git submodule update --init && git submodule update && git submodule foreach "git checkout master; git pull origin master" && git submodule foreach git clean -f
git submodule update --init --recursive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment