Git
From Sit
| SiT! Manual | Developers Guide → Git | Chapter 6 |
We're using Git distributed version control for our SiT! development for version 4.0 and beyond. This page explains how to download the source code for SiT! and make changes to it. You can also participate in our project by sending your changes to us.
Contents |
[edit] Get a copy of the SiT! Source code
If you don't want to make any changes to SiT, you can grab the latest version as a tarball from: http://gitorious.org/sit/sit/archive-tarball/master or if you prefer a git copy:
git clone git://gitorious.org/sit/sit.git
[edit] Git for patchers
- Register for an account over a Gitorious
- Click on the SiT account page
- Click 'Clone this repository on Gitorious' - this will create a copy of SiT's code for you to work on
- The following applies to *nix and Mac OS X, Windows users will need to perform this with a GUI tool for Git (link here)
- $ git config --global user.name "Name"
- $ git config --global user.email "test@example.com"
- Next we need to download your copy of the code, on Gitorious, click your name at the top right. Under 'Your Respositories' you will have ~name/sit/name-sit - click this
- In the box at the top there will be a command which starts 'git pull', run that on your command line:
git clone git@gitorious.org:~NAME/sit/NAME-sit.git
- Make your changes to SiT
- Now we need to give our changes back:
git commit -am "Fix bug 123"
- git push git@gitorious.org:~<NAME>/sit/<NAME>-sit.git # (This is underneath your git clone address on Gitorious)
- Back on your Gitorious page, click 'Request merge' and enter a description and comment of your changes
Done!
NOTE: If you plan to keep submitting patches, it is useful to keep your code up to date with the latest development code. Please follow Add SiT repo as a remote branch and Keep your personal branch up to date with SiT in the Developer's section.
[edit] Git for developers
First follow steps 1 through 6 in the Git for patchers section above.
[edit] Add SiT's repo as a remote branch
$ git remote add sit git@gitorious.org:sit/sit.git
$ git fetch sit
$ git checkout -b sit sit/master
[edit] Keep your personal branch up to date with SiT's
Make sure you are have your master branch checked out (i.e. $ git checkout master)
$ git fetch sit
$ git merge sit/master
[edit] Making a change to SiT's code
This doesn't have to be done in full every time, but for completeness:
$ git checkout master
$ vim file.php # make changes
$ git commit -am "fix a bug" # to commit all changed files, remove the -a to just specify files
$ git push origin master
$ git checkout sit # make sure you are up to date, see steps below
$ git merge master -m "Some changes to foo to fix foobar" # pulls in your bug fix
$ git push sit master
[edit] Delete a branch
$ git branch -d branchname # deletes your local branch branchname
$ git push repository :branchname # deletes the remote branch branchname at repository e.g. origin
[edit] Track another developer's branch
$ git remote add johnsmith git://gitorious.org/~johnsmith/sit/johns-sit.git
$ git fetch johnsmith
$ git checkout -b johnsmith johnsmith/master
[edit] Adding git's current branch to bash
No more merging with the wrong branch! Add the following code to your ~/.bashrc to get a prompt like: [kieran@kieran-netbook:~/Code/sit(master)]
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function proml {
case $TERM in
xterm*)
TITLEBAR='\[\033]0;\u@\h:\w\007\]'
;;
*)
TITLEBAR=""
;;
esac
PS1="${TITLEBAR}\
[\u@\h:\w\$(parse_git_branch)]\
"
PS2='> '
PS4='+ '
}
proml

