Skip to content

Instantly share code, notes, and snippets.

@msalvadores
Created March 27, 2011 12:21
Show Gist options
  • Save msalvadores/889157 to your computer and use it in GitHub Desktop.
Save msalvadores/889157 to your computer and use it in GitHub Desktop.
my git/github cheat sheet
" author: Manuel Salvadores http://msalvadores.me "
" My notes on using git/github "
#---- workflow on remote public forked repositories ----
#checkouts master branch from a forked github repo
git clone <git path to my forked repo>
#adds origin for futures merges/pulls
git remote add <name_origin> <git path to original repo>
git clone git@github.com:msalvadores/4store.git #for example
#bring changes from origin branch
git pull <name_origin> <branch origin>
git pull garlik master #for example
#to reflect a pull in remote forked repo we have to push.
git push
#note: after a pull if no changes in local repo then no need
#for "git add" "git commit"
#--------- working against my public repo (no branches) -----
#create local repo
git clone <path>
#edits ... and then ...
git status
git add -i (interactive add)
git commit --message "message for commit"
git push
#if forked repo ... then request pull via github.
#-------------- working against my public repo (branches) ------
#create new branch
git branch <branch name>
#list branches
git branch
#switch branch
git checkout <branch name>
#delete branch
git branch -d <branch name>
#list remote branches - not locally checked out
git branch -a
#cloning a branch ...
git checkout -b <local name> <remote name>
git checkout -b rdfs-reasoner remotes/origin/rdfs-reasoner #for example
#merge master with current branch
git merge master
#-------------- tags ------
#create
git tag tag_name
git push --tags
#remove tag with name 12345
git tag -d 12345
git push origin :refs/tags/12345
#explore log
#list last commits ...
git log
#list changes in commit
git show [commit_hash_code]
#list only files changed in commit
git show --pretty="format:" --name-only [commit_hash_code]
#new branch
git branch new_branch
git checkout new_branch
--- edit some stuff ---
git commit -m "new stuff in new branch"
git push ?
-- after some time git merge ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment