Skip to content

Instantly share code, notes, and snippets.

@nadavmatalon
Last active October 6, 2016 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nadavmatalon/1bb722fce6f2819658e68c6effd45ed9 to your computer and use it in GitHub Desktop.
Save nadavmatalon/1bb722fce6f2819658e68c6effd45ed9 to your computer and use it in GitHub Desktop.
GITHUB COMMANDS

GITHUB COMMANDS

COMMAND ACTION NOTES
git init initialize a local repo
git status shows current repo status
git status -s shows current repo status: abbreviated version
git remote add remoteName remoteURL adds a remote with given name & destination URL
git remote lists all remotes
git remote -v lists all remotes & destination URLs
git remote rm remoteName deletes specified remote
git add fileName stages specified file
git add . stages all files
git commit commits all staged files
git commit -m "commitComment" commits all staged files with given comment
git commit -a -m "commitComment" stages & commits all files with given comment
git push -u origin branchName creates & associates new branch in remote (if needed) & pushes all commited files to it
git push origin master pushes all committed files to master
git push -u origin master associates local master with remote master & pushes the commited files
git branch branchName creates a new branch
git checkout branchName switches to specified branch
git checkout -b branchName creates & switches to a new branch
git branch -m newBranchName renames current branch only use from within the branch to be changed
git merge branchName merges specified branch with master first run: 'git checkout master'
git checkout master switches back to master branch
git stash stashes changes on current branch
git branch -d branchName deletes specified branch
git tag lists all versioning tags
git tag -a tagName -m "tagComment" adds annotated tag with specified name (eg v1.0.0) & descriptional comment
git tag -a tagName commitChecksum adds tag to a pervious commit first run: git log --pretty=oneline
git show tagName shows information of tag with tagName
git push origin tagName pushes specified tag to remote does not happen automatucally with ordinary pushes
git push origin --tags pushes all tags to remote
git pull --tags pulls all existing tags from remote does not happen automatucally with ordinary pulls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment