Notes on my git usage
Common Commands
-
git remote -v
-
git branch
-
git config --global user.name "John Doe"
-
git config --global user.email johndoe@example.com
-
git config --global core.editor "C:\Program Files (x86)\Notepad++/notepad++.exe"
-
git config --list
My process
Create master repo
-
mkdir xxx
-
cd xxx
-
git init --bare
Go to directory with files and make it a repo
-
git init
-
git add *
-
git commit -m "Initial Version"
-
git remote add origin xxx
-
git config --global push.default upstream
-
git push --set-upstream origin master
-
git push
To make a clone
-
git clone xxx
Tutorial: http://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup
Creating branch
http://thelucid.com/2008/12/02/git-setting-up-a-remote-repository-and-d…
Revert changes
Getting rid of local uncommited changes
-
git stash
-
git list
-
git stash clear
Getting rid of local commits
-
git reset --hard origin/master
Removing accidentally created branches
View branches
-
git branch -a
Delete it from github.
In clones use
-
git fetch --all --prune
Create a temp branch from a previous commit
-
git checkout -b temp_branch 59254ed9e1e3ad4fbdd53199c87ce4e75d346bbd
Delete branch
-
git branch -d BRANCH_NAME
Switch branch
-
git checkout BRANCH_NAME
Display cached differences you are about to commit
-
git diff --cached
-
git diff **Filename**
RJM Article Type
Quick Reference