git usage in the dpkg team
Recommendations for handling the git repository.
- For committers:
For anonymous: git clone https://anonscm.debian.org/git/dpkg/dpkg.git
- Private repositories of current maintainers:
Guillem Jover: https://git.hadrons.org/git/debian/dpkg/dpkg.git (web)
- In the main repository we have the following branches:
- master: Main development tree.
- sid: Bug fixes only branch (used when important fixes have to be pushed out before the end of the current development cycle).
- 1.17.x: Branch corresponding to the Debian jessie release.
- 1.16.x: Branch corresponding to the Debian wheezy release.
- 1.15.x: Branch corresponding to the Debian squeeze release.
- 1.14.x: Branch corresponding to the Debian lenny release.
- 1.13.x: Branch corresponding to the Debian etch release.
- jessie, wheezy, squeeze, lenny, etch: Symbolic reference branches for the corresponding Debian release.
- next/*: Branches with prospective changes to be merged into the respective parents.
- In the private repositories of maintainers, you might find other topic branches. Beware that those prefixed with "pu/" are "proposed-updates" that can be rebased at any time, don't use them for long-lived work.
Do not forget to let git know who you are: git config user.name "John Doe" && git config user.email email@example.com (you can also use the --global option if you want to configure it the same for all git repositories)
- When you write commit messages, try to follow the recommended format:
possible-subsystem: Short summary The rest is the long description. It explains the change in more details and gives the rationale associated to it. You can be as verbose as you want.
If you commit someone else's work, please use git commit --author "Random Joe <firstname.lastname@example.org>" to properly attribute the change.
- If you are working on a patch that will take some time to be merged, better work on it in a private topic branch that you can rebase (later and as many times as you want) before merging it in the master branch and pushing it. This will avoid cluttering the history with merge commits.
How to release
- Verify that you're in sync with the remote repository.
- Finalize the changelogs, commit the changes.
git commit -a -m "Release <version>"
- Create a signed tag:
git tag -m "Release <version>" -s <version>
- Generate a source tarball:
git clean -Xdf
autoreconf -f -i; ./configure; DPKG_DEVEL_MODE=1 make distcheck
- Do the real build based on the generated tarball.
dpkg-buildpackage -us -uc
- In general, install the resulting packages and rebuild (this ensures the generated packages are accepted by the archive).
- Run the functional test suite from the dpkg-tests.git repository.
cd dpkg-tests; make test-clean clean; make test 2>&1 | tee test.log
- Push stuff to the remote repository:
git push origin master <version>
- Upload to Debian.
For possibly disruptive or big changes consider uploading just after the buildd chroots have been upgraded, which currently happens on Wed and Sun at 21:13 UTC (see puppet definition surroundings).
- For a release from the master branch:
- Start a new version:
On debian/changelog, '<version>' and suite UNRELEASED (dch -i should do).
- Commit and push.
- Start a new version:
- For a release from the sid branch:
- Switch to the master branch.
- Merge the sid branch (fix conflicts on changelogs).
- Commit and push.
- To setup the repository:
- Clone the repository as above.
Enable the pre-commit hook with chmod +x dpkg/.git/hooks/pre-commit (this will prevent committing conflicts by error)
Tell Git who you are: git config user.name "John Doe" && git config user.email email@example.com
- If updating for buster:
Use origin/master as <remote>.
- If updating for stretch:
Switch to that branch: git checkout -b 1.18.x origin/1.18.x
Use origin/1.18.x as <remote>.
- If updating for jessie:
Switch to that branch: git checkout -b 1.17.x origin/1.17.x
Use origin/1.17.x as <remote>.
- If updating for wheezy:
Use origin/1.16.x as <remote>.
To update the repository use the commands: git fetch && git rebase <remote>
- Once you finished your work use the following commands to commit and push your changes:
git add <list of modified files>
If the git push fails, redo the command git fetch && git rebase <remote> and try again. Note that git rebase can be interrupted if there's a conflict between your work and the changes made on the remote repository. In that case, fix the conflicts by editing the conflicted files, then git add <conflicted files> and ask the rebase process to continue with git rebase --continue. Once it is over, git push should work.
git, as a distributed VCS, allows you to make multiple commits without pushing your changes back, please avoid that if possible. We advise you to not multiply commits uselessly because they clutter the historical log and it's more difficult to see important changes on the code (instead of the translations). If you have multiple commits waiting to be pushed, git offers you a possibility to "merge" them in a single commit. Proceed as follows (we assume you are on the branch where you did the multiple commits, all the changes are already commited, and the branch is named $BRANCH):
git branch -f l10n (create a new branch l10n containing all your changes, remove any preexisting l10n branch)
git reset --hard origin/$BRANCH (drop your changes in the current branch)
git merge --squash l10n (merge your changes in a single commit, you have to edit the commit message)
- You can proceed to push the changes.