Cheat Sheet for Common Git commands
http://www.git-tower.com/learn
http://rogerdudler.github.io/git-guide/
git config --get user.email
git config user.email "email@sample.com"
git config --global user.name "sample name"
git clone ssh://user@domain.com/repo.git
git init
git status
git diff
git add .
git add *
git add *.php
git add -p <file>
git commit -a
###Commit previously staged changes
git commit -m "your commit message"
git commit --amend
git log
git log -p <file>
git blame <file>
git fetch -av
git checkout -b branch_name remote_branch_name
(e.g. git checkout -b feature-amp-style-fixes origin/feature-amp-style-fixes)
git branch -av
git checkout <branch>
git branch <new-branch>
git checkout --track <remote/branch>
$ git branch -d <branch>
git tag <tag-name>
git branch -d the_local_branch
git push origin :the_remote_branch
git push origin --delete the_remote_branch
git remote -v
git remote show <remote>
git remote add <shortname> <url>
git fetch <remote>
git pull <remote> <branch>
git push <remote> <branch>
git branch -dr <remote/branch>
git push --tags
git merge <branch>
git rebase <branch>
git rebase --abort
git rebase --continue
git mergetool
git add <resolved-file>
git rm <resolved-file>
git submodule add https://github.com/cloudcreatordotio/name-of-plugin /wp-content/plugins/name-of-plugin
git submodule update --init --recursive
git clone --recurse-submodules https://url/for/repo
git pull origin master --recurse-submodules && git submodule update --init --recursive
git reset --hard HEAD
git reset --hard @{u} or git reset --hard @{upstream}
git checkout HEAD <file>
git revert <commit>
git reset --hard <commit>
...and preserve all changes as unstaged changes
git reset <commit>
...and preserve uncommitted local changes
git reset --keep <commit>
git help <command>
Usually you don't create branches directly in the bare repository, but you push branches from one work repository to the bare
git push origin myBranch
Update: Worth to mention
git push origin localBranchName:remoteBranchName
you push (and create, if not exists) your local branch to the remote with a different branch name, that your local one. And to make it complete with
git push origin :remoteBranchName
you delete a remote branch.
If you want to give the branch another name then use:
git push origin localBranchName:remoteBranchName
git remote rm destination
git remote -v
git remote set-url origin https://github.com/USERNAME/REPOSITORY.git