Last active
November 25, 2020 17:30
-
-
Save donigian/5627689 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set up the submodule for the first time: | |
[~]$ cd ~/main/ | |
[main]$ git submodule add git://github.com/my/submodule.git ./subm | |
[main]$ git submodule update --init | |
[main]$ git commit ./submodule -m "Added submodule as ./subm" | |
Fetch submodules after cloning a repository: | |
[~]$ git clone git://github.com/my/main.git ~/main | |
[~]$ cd ~/main/ | |
[main]$ git submodule update --init | |
Pull upstream main repo changes and update submodule contents: | |
[main]$ git pull origin/master | |
[main]$ git submodule update | |
Pull upstream changes to the submodule: | |
[main]$ cd ./subm | |
[subm]$ git pull origin/master # or fetch then merge | |
[subm]$ cd .. | |
[main]$ git commit ./subm -m "Updated submodule reference" | |
Edit and commit files in your submodule: | |
[main]$ cd ./subm | |
[subm]$ edit whatever.rb | |
[subm]$ git commit whatever.rb -m "Updated whatever.rb" | |
[subm]$ cd .. | |
[main]$ git commit ./subm -m "Updated submodule reference" | |
Push your submodule changes to the submodule upstream: | |
[main]$ cd ./subm | |
[subm]$ git push origin master | |
# List all the stashes | |
$ git stash list | |
stash@{0}: WIP on admin_ui: 0c1a80a Removed annotation from JdbcAdminService, it is now explicity initialized in the applicationContext. | |
stash@{1}: WIP on admin_ui: 14e12e6 Added foreign keys for UserRole | |
stash@{2}: WIP on master: d188ecd Merge branch 'master' of semc-git:customercare | |
stash@{3}: WIP on master: 3763795 More work on user_details. | |
... | |
# Apply the latest stash, and remove it from the stack | |
$ git stash pop | |
# Apply a named patch, but leave it on the stack | |
$ git stash apply stash@{2} | |
# Drop a stash | |
$ git stash drop stash@{3} | |
# Clear the entire stash stack (almost never needed) | |
$ git stash clear | |
# A better way to purge the stash | |
$ git reflog expire --expire=30.days refs/stash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment