Intro to using git

Setting up your environment
git clone git@gitorious.org:~/statusnet/.git
 * 1) Install Git on your workstation.
 * 2) In a Web browser: create an account on gitorious http://gitorious.org.
 * 3) Go to the StatusNet project page on gitorious . Click on "mainline."
 * 4) Click on "Clone this repository on Gitorious." You will be prompted to enter a name for your clone.
 * 5) Locally, download the clone of StatusNet:

Add statusnet's mainline git to your local repository so you can stay up-to-date: cd  git remote add statusnet git://gitorious.org/statusnet/mainline.git git fetch statusnet

Create a branch that tracks your (origin) branch of 0.9.x. Complete this action from within the repository directory: git checkout -b 0.9.x statusnet/0.9.x

Let's get developing!
Think of a new feature or bug fix for 0.9.x: cd  git checkout 0.9.x git branch  git checkout  Do some development. Things to keep in mind: Keep the scope of the branch limited to a feature or bug fix, it makes merge requests easier to review.

Commit your changes: git commit -a You should &quot;rebase&quot; your &quot;&quot; branch before you submit your branch. This will first take out your changes, apply any upstream changes, then try to remerge your changes. This will allow you to solve any conflicts your patch may have. git fetch statusnet git rebase statusnet/0.9.x

While you're developing
Be sure to check for updates from the mainline of statusnet to your branch: (Do this as often as you like to keep up to date) git checkout 0.9.x # Making sure we're on the correct branch git merge statusnet/0.9.x

Push your changes to gitorious
git push origin 
 * Upload your revised branch to Gitorious:

Creating a merge request in Gitorious
Once you've committed your work branch and pushed it back into your personal clone in Gitorious, you can create a merge request which will alert the StatusNet core developers that your changes are ready, conveniently showing what's changed and giving a place for comments and further revisions.


 * 1) Go to the Gitorious Web site http://gitorious.org. Login and go to the clone you created in the first part of this tutorial.
 * 2) Click the "Request merge" button on the sidebar
 * 3) Fill out the fields...
 * 4) * Summary one-line description
 * 5) * "Description more detailed description; references to related bug reports or documentation are always great here -- make sure reviewers know the purpose of your patch and what it's trying to resolve
 * 6) * "Target repository in most cases this should be "mainline", unless you're coordinating with another developer's personal work clone
 * 7) *  Target branch  this is the easiest to get wrong! It defaults to "master" but in most cases you'll probably have been working against the current development branch such as "0.9.x". You must choose the same source branch you were originally working from, or the diffs won't display correctly and it'll be a lot harder to review the changes.
 * 8) * Source branch select the work branch on your personal clone that you're merging.
 * 9) * Select commits generally you'll select all changes from the branch point to your last change.
 * 10) When done, click "Create merge request".

A mail will be sent out to notify the core developers. Any comments on the request will alert you back via e-mail as well.

Tips
git branch -a # show all branches git branch -D  # delete branch, it's ok they're free!

If you want to keep our remote branch up-to-date (say more than one dev working on the same branch) then we can push them there for everone: git fetch statusnet git checkout 0.9.x # Making sure we're on the correct branch git merge statusnet/0.9.x

git push origin HEAD

git diff # Shows changes between now and last commit git reset --hard HEAD~ # undoes last commit

git config
git config --global user.name "FirstName LastName" git config --global user.email "user@example.com" git config --global color.ui "auto"

Useful links

 * Understanding Git Conceptually
 * http://www.sourcemage.org/Git_Guide
 * http://git.or.cz/gitwiki/GitFaq
 * http://status.net/trac/wiki/IntroToUsingGit?version=12 - Previous version, works, but this is a better workflow