Standard commands
git clone [email protected]:[username]/[project-name].git
git pull
git fetch
git push
git status
git log
git diff file...
git commit -a -m "msg"
git commit --amend
Change URL
git remote set-url origin [email protected]:[username]/[project-name].git
Show URL
git remote show origin (shows more detail)
Change branch:
git checkout [branch-name]
Create and change to branch
git checkout -b [new-branch-name]
Merge another branch
git merge [branch-name]
List remotes
git remote [-v]
Remove Remote
git remote rm remote_name
Add submodule
git submodule add [email protected]:[username]/[project-name].git path/for/submod
Recursive clone
Remove Remote
git clone --recursive [email protected]:[username]/[project-name].git
Recursive push
git submodule foreach git push (only pushes submodules)
git push --recurse-submodules=on-demand
Rebase 3 commits from head
git rebase -i HEAD~3
-i
is interactive, Git base to a specific commit
git rebase -i <hash> (this should be the commit before the one you want to go back to)
Rebase to a different branch
git rebase upstream/master