Table of contents
- Firefox Developer Git Quick Start Guide
Firefox Developer Git Quick Start Guide
Getting setup to as a first time Mozilla contributor is hard. There are plenty of guides out there to help you get started as a contributor, but many of the new contributor guides out of date often more current ones are aimed at more experienced contributors. If you want to review these guides, you can find several linked to from Contributing to the Mozilla code base on MDN.
This guide will take you through setting up as a contributor to
mozilla-central, the Firefox main repository, as a git user.
The first thing you will need is to install Mercurial as this is the VCS that
brew install mercurial
sudo port install mercurial
sudo apt-get install mercurial
Alternatively you can install Mercurial directly.
Check that you have successfully installed Mercurial by running:
If you are an experienced git user and are unfamiliar with Mercurial, you may want to install
git-cinnabar. Cinnabar is a git remote helper that allows you to interact with Mercurial repos using git semantics.
There is a Homebrew install option for
git-cinnabar, but this did not work for me, nor did the installer option. Using these tools, when I tried to clone the Mercurial repo it hung and did not complete. I had to do a manual install before I could use
git-cinnabar successfully to download a Mercurial repo. If you would like to try either of these option, however, here they are:
brew install git-cinnabar
git cinnabar download
git clone https://github.com/glandium/git-cinnabar.git && cd git-cinnabar make export PATH="$PATH:/somewhere/git-cinnabar/" echo PATH="$PATH:/somewhere/git-cinnabar/" >> ~/.bash_profile export PATH="$PATH:/somewhere/git-cinnabar/git-core/bin-wrappers" echo PATH="$PATH:/somewhere/git-cinnabar/git-core/bin-wrappers" >> ~/.bash_profile
- initialize an empty git repository
git init gecko && cd gecko
- Configure git:
git config fetch.prune true git config push.default upstream
- Add remotes for your repositories. There are several to choose from,
releaseetc. but in reality, if you plan on using Phabricator, which is Firefox’s preferred patch submission system, you only need to set up
central. It might be advisable to have access to
inboundhowever, if you want to work on a version of Firefox that is queued for release. This guide will be focussed on Phabricator.
git remote add central hg::https://hg.mozilla.org/mozilla-central -t branches/default/tip git remote add inbound hg::https://hg.mozilla.org/integration/mozilla-inbound -t branches/default/tip git remote set-url --push central hg::ssh://hg.mozilla.org/mozilla-central git remote set-url --push inbound hg::ssh://hg.mozilla.org/integration/mozilla-inbound
- Expose the branch tip to get quick access with some easy names.
git config remote.central.fetch +refs/heads/branches/default/tip:refs/remotes/central/default git config remote.inbound.fetch +refs/heads/branches/default/tip:refs/remotes/inbound/default
- Setup a remote for the try server. The try server is an easy way to test a patch without actually checking the patch into the core repository. Your code will go through the same tests as a
mozilla-centralpush, and you’ll be able to download builds if you wish.
git remote add try hg::https://hg.mozilla.org/try git config remote.try.skipDefaultUpdate true git remote set-url --push try hg::ssh://hg.mozilla.org/try git config remote.try.push +HEAD:refs/heads/branches/default/tip
- Now update all the remotes. This performs a
git fetchon all the remotes. Mozilla Central is a large repository. Be prepared for this to take a very long time.
git remote update
All that’s left to do now is pick a bug to fix and submit a patch.