WARNING: Not yet reviewed, could have bugs! "git <command> --help" to be sure.
1. 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
1.1. Commit message
If a commit fixes a GNOME bug, finish your commit message with "Fixes bug #1234". For example:
1.2. Bugzilla integration
This is an attempt to integrate our git workflow with Empathy's bugzilla.
1.2.1. Configuration
Get git-bz: http://git.fishsoup.net/cgit/git-bz
- edit .git/config in your Empathy git repo and add the following options:
[bz] default-tracker = bugzilla.gnome.org default-product = empathy default-component = General
1.2.2. Submit patches
- Let's say you have a branch "fix-12345" fixing bug #12345
- git-bz attach 12345 master...fix-12345
1.2.3. 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 patches:
- git-bz attach -e 12345 master...fix-12345
- Mark old patches as obsoltes
1.2.4. Merge branches
- Once reviewer is happy with the branch, he marks the last diff as 'accepted-commit_now'
- If the author has a git account he merges his patches to 'master':
- git checkout master
- git pull
- git merge fix-12345
- git-bz push origin master
- If he doesn't have a git account, one maintainer will merge the patches for him