Disclaimer: This article will be updated from time to time to add new content or make any changes in exsisting sections without any notice. Using them under your own investigation in production is advised.
I. Git Submodule
1. Delete a submodule
1
2
3
4
5
6
7
8
9
10
git submodule deinit {MOD_PATH}# delete mod info from .gitmodulescat .gitmodules | gre -v {MOD_PATH} > .gitmodules
# use --cached to clear info in .git/modulesgit rm --cached {MOD_PATH}git commit -am "Remove a submodule."
2. Modify submodule URL
1
2
3
4
5
6
7
8
9
10
# 1. modify submodule url in .gitmodulesvim .gitmodules
# 2. use `git submodule sync` to flush URL into .git/configgit submodule sync
cat .git/config
# 3. commit changegit commit -am "Update submodule url."
II. Git ADD options(-A, ., -u)
git add -A - add all file changes, including updating, adding and deleting.
git add -u - add changes of indexed files, including updating and deleting.
git add . - add changes of files in current working directory, including adding, updating but excluding missing files.
git init
echo Change me > change-me
echo Delete me > delete-me
git add change-me delete-me
git commit -m initial
echo OK >> change-me
rm delete-me
echo Add me > add-me
git status
# Changed but not updated:# modified: change-me# deleted: delete-me# Untracked files:# add-megit add .
git status
# Changes to be committed:# new file: add-me# modified: change-me# Changed but not updated:# deleted: delete-megit reset
git add -u
git status
# Changes to be committed:# modified: change-me# deleted: delete-me# Untracked files:# add-megit reset
git add -A
git status
# Changes to be committed:# new file: add-me# modified: change-me# deleted: delete-me
III. Mirror
Thanks to some great firewalls, you may need to use a mirror site to access github.com.