Git CheatSheet
CheatSheet for git commands:
# clone a github repository
git clone https://github.com/baldeephira/casper-slidr.git
# changed files in working dir
git status
# show the change log
git log
# stage all current changes for next commit
git add .
# stage <file> for next commit
git add -p <file>
# commit previously staged files
git commit -m "my msg"
# stage current changes then commit (excludes new files)
git commit -a
# push commited changes to origin master
git push
# only fetch changes from remote
git fetch
# merge changes from origin
git merge
# fetch from remote and merge
git pull
# create a new branch 'abc'
git branch abc
# switch to using branch 'abc'
git checkout abc
# overwrite local changes and remove all local changes
git fetch origin
git reset --hard origin/master
Posted on
Aug 10, 2012 at 20:04