Table of Contents
-
view all branches including remote
git branch -a # may require git fetch to view other remotes git fetch jonfk
-
fetch a remote branch
git checkout --track origin/remote_branch_name # or create new branch tracking remote branch git checkout -b remote-branch-name origin/remote-branch-name
-
checking out a new branch
git checkout -b new_branch_name
-
deleting a remote branch
git push origin --delete <branchName>
-
deleting a local branch
git branch -D <branchName>
-
Undo git add
git reset
-
Undo git commit
git reset --soft HEAD~1
-
Discard all uncommitted work
git checkout -- . # or git reset --hard
-
Remove all untracked files and directories
git clean -fd
-
add submodule
git submodule add https://github.com/<user>/rock rock # or git submodule add [email protected]:<user>/rock rock
-
Download the contents of submodules
git submodule update --init --recursive
-
Clone repository and download submodules
git clone --recursive <project url>