A deliberately minimal set of commands for using GIT as simply as possible. Note:
- GIT will ask for some details the first time you use it on a machine
- these instructions will need a repo on GitHub for you to push to
- don't create a readme.md file on GitHub, make it locally and push
git init
git status
git add .
git commit -m "describe change"
git status
git remote add origin URL_of_remote_repo_here
git remote -v
git push -u origin master
git clone URL_of_remote_repo_here
- (do some work)
git add .
git commit -m "describe change"
git status
git push
git checkout -b branchname_here
- (do some work)
git add .
git commit -m “describe change”
- (repeat 2-4)
git push -u origin branchname_here
git checkout master
git diff master branchname_here
- (repeat 2-4 if necessary)
git merge branchname_here
- (repeat 2-4 if necessary)
git branch -a
(lists all branches)git branch -d
(use-D
to force delete)
git log --pretty=oneline
git fetch origin
(override local changes)git reset --hard origin/master
git checkout -- filename_here
(restore previous version of file)git reset —hard HEAD~
(revert to previous commit)
git clone URL_of_remote_repo
git remote set-url origin URL_of_NEW_repo
git remote -v