Skip to content
This repository has been archived by the owner on Oct 18, 2022. It is now read-only.

Git Help

alexbowe edited this page May 13, 2011 · 10 revisions

##Quick Example##

An example on how to add code to develop (this is where we will upload, when it's ready it will move to master)

Switch to develop:

git checkout develop

After working on it:

git add [new files]
git commit
git push origin develop

You can update the content:

git pull origin develop

If you do a git commit before you push, but wished you hadn't do:

git reset <file>

If you want to undo the changes then (go back to the repository version):

git checkout <file>

##What to do if you contaminate Master##

If you accidentally push to the wrong branch, here are the steps I used to reverse it:

git reset --hard HEAD^
HEAD is now at e5a72d6 Fix markdown bullet points

This reversed the local branch (so if you committed but didn't push, you can stop here). Notice the e5a72d6, you will need that:

git push -f origin e5a72d6:master
Total 0 (delta 0), reused 0 (delta 0)
To https://[email protected]/fclaude/libcds2.git
 + 8960e71...e5a72d6 e5a72d6 -> master (forced update)

The -f flag forces the push, even though the local one is older than on the origin.

##Reading Material##

Here are some resources to help you with Git. Of course, you don't have to read all of this :) I have put a ★ next to the ones I think should be understood.

###Introductions, to help you get started###

###Advanced Materials for the Inquisitive###

###References###

###Longer resources###

  • Pro Git free eBook by Scott Chacon (a GitHub developer)
Clone this wiki locally