Skip to content

Instantly share code, notes, and snippets.

@stevenvo
Last active January 28, 2018 21:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevenvo/73007912f7f913bf88e13004acb77efc to your computer and use it in GitHub Desktop.
Save stevenvo/73007912f7f913bf88e13004acb77efc to your computer and use it in GitHub Desktop.
Useful Git Command
# Pulling a git repository as a git module into your project
# "master" is the branch of the remote repository to use
git submodule add -b master https://github.com/Komodo/trackchanges.git src/modules/trackchanges
# get status recursively
git submodule status --recursive
# Iterate through all git submodule to add and comment and commit
git submodule foreach git add .
git submodule foreach git commit -m "test"
git submodule foreach git push
# git submodule foreach git push -u origin master
## BASH file that add, comment, and commit using comment as input
#!/bin/bash
git submodule foreach git add .
git submodule foreach git commit -m "$1"
git submodule foreach git push
git add .
git commit -m "$1"
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment