git quickstart guide


  • View git help
    git help <command>
  • Set your name (if necessary)
    git config –global “Your Name”
  • Set your email address (if necessary)
    git config –global
  • Save remote https credentials (for 15 minutes, by default)
    git config –global credential.helper cache
  • Save remote https credentials with different timeout (seconds)
    43200 = 12 h
    86400 = 24 h
    2592000 = 30 d
    git config –global credential.helper ‘cache –timeout=2592000’
  • Check config
  • Make an initial clone copy of the existing repo from the server
    git clone
  • Add the remote repo (so that you can then sync with it)
    The repo that you originally cloned the files from is always automatically called ‘origin’.
    git remote add <reponame>
  • Check which remote servers you have added
    git remote [-v]
  • Pull data from the named branch on the server
    (In other words, update your local copy from the remote)
    git pull <reponame> <branchname (eg) master>
  • Download any (all) changes from the remote server (but does not merge with local files (not sure what this means?))
    git fetch <reponame>
  • Check status of your local files
    git status
  • View git log of changes
    git log
  • Check status of files on remote server
    git remote show <reponame>
  • Add a file/folder(s) to version control locally (or add changes to local staging area)
    git add “filename foldername”
  • Commit a change locally
    git commit “filename filename” -m ‘Commit log comment’
  • Commit all changes locally (NB: note the dot)
    git commit . -m ‘Commit log comment’
  • Push changes back to master (on the remote server)
    eg: git push origin master
    git push “your files” <reponame> <branchname (eg) master>
  • List branches
    git branch
  • Create a new branch <branchname>
  • git branch <branchname>
  • Switch to branch <branchname>
    git checkout <branchname>

See also: