WARNING: Not yet reviewed, could have bugs! "git <command> --help" to be sure.
How to work with git
Create your own repository in a public git server:
Create a clone of the official archive: git clone --bare git://git.gnome.org/empathy
- Edit description file and write a description of your repos
If your public server doesn't run git-daemon, you can still access it using http. You just have to set post-update script executable: chmod +x hooks/post-update
Copy the repository to your server, usually in ~/public_html/git. You can also upload to your github.com account.
Create your working repository on your laptop:
On your laptop: git clone git://git.gnome.org/empathy
Add a remote location for your public clone, for example: git remote add mypublicrepos git+ssh://git.collabora.co.uk/git/user/<user>/empathy.git
You can add a remote location for branches of other people. To get xclaesse branches of empathy: git remote add xclaesse git://git.collabora.co.uk/git/user/xclaesse/empathy.git
To update the code from all your remote locations: git remote update
Now you can see all branches using git branch -a
You want to fix a bug from the "broken" branch in "xclaesse"'s repository?
git checkout -b myfixbranch xclaesse/broken
- fix the bug
git commit -a
git push mypublicrepos myfixbranch
- go to IRC/bugzilla and tell him to pull your branch
The bug is now fixed you can remove your branch: git branch -D myfixbranch
Your branch got merged, remove it from your public repository:
If your server has git >= 1.5: git push mypublicrepos :mymergedbranch
- Otherwise you have to log on your server using ssh and type:
export GIT_DIR=.
git branch -D mymergedbranch
Other things:
If there is new code on official repos, update your clone: git pull
If you have a myfix branch that needs to be updated with the new code in master: git checkout myfix && git merge master
xclaesse removed a branch from his public repos, to remove that branch from your clone: git remote prune xclaesse
Commit message
If a commit fixes a GNOME bug, finish your commit message with "Fixes bug #1234". For example:
Bugzilla integration
This is an attempt to integrate our git workflow with Empathy's bugzilla.
Configuration
Get git-send-bugzilla: http://git.collabora.co.uk/?p=user/cassidy/git-bugzilla;a=shortlog;h=refs/heads/description (FIXME: use upstream once patches have been merged)
- edit .git/config in your Empathy git repo and add the following options:
[bugzilla]
url = "http://bugzilla.gnome.org"
username = "gdesmott@gnome.org"
password = "XXXXX"
squash = 1
Submit branches
- Let's say you have a branch "fix-12345" fixing bug #12345 and $URL is the gitweb http address of your branch
- git-send-bugzilla -m "Proposed fix in branch fix-12345 $URL" 12345 master
Review branches
- Add your review comments on #12345 and mark the attached patch as "reviewed"
- The author fixes comments and attach the new version of the diff:
- git-send-bugzilla -m "Fix review comments of Alice" 12345 master
Merge branches
- Once reviewer is happy with the branch, he marks the last diff as 'accepted-commit_now'
- The author merge it to the 'master' branch and close the bug
