Skip to content

Instantly share code, notes, and snippets.

@chrislovecnm
Created December 27, 2011 21:37
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 chrislovecnm/1525241 to your computer and use it in GitHub Desktop.
Save chrislovecnm/1525241 to your computer and use it in GitHub Desktop.
Git Cheat Sheet

Git overview / cheat sheet

Some common commands that are used with git

  • init
  • log
  • rebase - like a merge (change the order of commits)
  • merge
  • commit
  • add
  • checkout
  • revert - kill the last checking (delete)
  • pack
  • pull
  • push
  • status
  • bisect - works with unit tests
  • clone - gets all branches within a repository
  • diff
  • grep - searches inside the code bases through history
  • tag
  • branch

Intial cloning of the source repo

git clone repo name - this pulls the code out of the remote repository

A typical dev squence

  • do some edits
  • git status - will show you what the status of the branch is
  • cd in the the dir you added git add . add all of the files in the directory recursively
  • git commit -m"did some edits good point to save locally" - checks in the source locally
  • repeat
  • you stop at a good point where you want to share your code
  • repeat the above git add and git commit sequences
  • execute git fetch
  • execute git merge origin/master
  • execute git push

Git Resources

#Get merging

  • first take a breath :)
  • if you do not have d/l perforce gui http://www.perforce.com/downloads/complete_list
  • execute git mergetool -t p4merge
  • execute git add appropriately
  • execute get commit -m
  • execute get fetch -m
  • execute get merge origin/master
  • execute a build - gotta test before you push
  • and finally git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment