Mozilla: A git workflow for Gecko development - glandium/git-cinnabar Wiki

Here is my recommended setup for Gecko development with git:

  • If you're on macOS you should just use the homebrew version of git-cinnabar. It will work out of the box. Otherwise you might run into python sadness. (Unsupported bundle version...)
  • Install mercurial (only needed for its libraries). You probably already have it installed. Eventually, this dependency will go away, because the use of mercurial libraries is pretty limited.
  • Install git-cinnabar (see the Setup section in the README—essentially just clone it somewhere, put the path to your local clone in your PATH, then install the native helper).
  • Clone the mozilla-unified repository:
$ git clone hg::https://hg.mozilla.org/mozilla-unified gecko && cd gecko
  • Set fetch.prune for git-cinnabar to be happier:
$ git config fetch.prune true
  • Assuming you have watchman installed (eg via brew install watchman on Mac), as well as git >= 2.16, set up your local git hook to make git status and friends faster:
$ mv .git/hooks/fsmonitor-watchman.sample .git/hooks/query-watchman
$ git config core.fsmonitor .git/hooks/query-watchman

With this setup, you can e.g. create new topic branches based on the remote branches:

$ git checkout -b bugxxxxxxx origin/bookmarks/central

To make the setup more idiomatic of git repos, you can add another fetch refspec:

$ git config --add remote.origin.fetch refs/heads/bookmarks/central:refs/remotes/origin/main

which allows you to do this:

$ git checkout -b bugxxxxxxx origin/main

When you're ready to test your code on try, you can use the mach try command, or, if you want to do things manually, setup a remote for the try server:

$ 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

then create a commit with the try syntax, and do:

$ git push try 

This will push whatever your checked-out branch is, to the try server (thanks to the refspec in remote.try.push).

Please report any issue you encounter in the comments, or, if they are git-cinnabar related, on github.

Other Tips

Checking out a changeset from try:

$ git cinnabar fetch hg::https://hg.mozilla.org/try <changeset>

or

$ git cinnabar fetch try <changeset>

if you have set up a try branch.

⚠️ **GitHub.com Fallback** ⚠️