Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Tools for working with Git at Mozilla

branch: master

Merge pull request #13 from jryans/no-wrap-user

Remove quotes around user name
latest commit ec3572f609
John Schoenick Nephyrin authored
Octocat-spinner-32 git-bz-moz @ 75f7f90 Bump git-bz-moz February 10, 2014
Octocat-spinner-32 private Moving check-for-updates into "private" directory so that it doesn't … November 27, 2012
Octocat-spinner-32 trychooser @ f5e7561 Updating trychooser submodule. December 14, 2012
Octocat-spinner-32 .gitmodules Update git-bz-moz github url + bump September 20, 2013
Octocat-spinner-32 LICENSE Adding LICENSE (CC0). May 30, 2013
Octocat-spinner-32 README.markdown Adding git-fix-whitespace tool. October 11, 2012
Octocat-spinner-32 git-branchname Adding git-branchname. March 04, 2012
Octocat-spinner-32 git-bz Adding git-bz-moz. January 18, 2012
Octocat-spinner-32 git-edit-files Don't try to edit deleted files with git-edit-files. June 27, 2013
Octocat-spinner-32 git-fix-whitespace Adding git-fix-whitespace tool. October 11, 2012
Octocat-spinner-32 git-new-workdir Adding license blurb to git-new-workdir. May 29, 2013
Octocat-spinner-32 git-patch-to-hg-patch Remove quotes around user name April 02, 2014
Octocat-spinner-32 git-push-to-hg Moving check-for-updates into "private" directory so that it doesn't … November 27, 2012
Octocat-spinner-32 git-push-to-try Use separate patch for try syntax March 21, 2014
Octocat-spinner-32 git-push-to-trychooser add quotes in the right places, suppress output of qpop after trychooser September 06, 2012
Octocat-spinner-32 git-qapplied Some cleanup for qapplied/qparent November 07, 2013
Octocat-spinner-32 git-qparent Some cleanup for qapplied/qparent November 07, 2013
Octocat-spinner-32 git-qrebase Adding qrebase. June 12, 2012
Octocat-spinner-32 git-remote-link Adding experimental git-remote-link tool. July 25, 2013
Octocat-spinner-32 git-root Adding git-root, which outputs the root of the current git repo. July 25, 2013
Octocat-spinner-32 git-to-hg-commit Fix usage message in git-to-hg-commit. October 18, 2012
Octocat-spinner-32 git-tracks Check that origin/master exists before using it November 07, 2013
Octocat-spinner-32 hg-patch-to-git-patch Use patch file name if commit message is empty March 26, 2014
Octocat-spinner-32 pre-commit Adding more helpful trailing-whitespace error message to pre-commit h… July 01, 2012
Octocat-spinner-32 test.sh Reworking git-patch-to-hg-patch so it doesn't wrap lines unnecessaril… June 20, 2012
README.markdown

Tools for working with Git at Mozilla.

In order to set this up, clone this repository somewhere, run the git submodule init and then git submodule update command, and add your clone to $PATH.

Many of these tools rely on a notion of your current branch's "upstream branch". For example, git push-to-try pushes to try all patches in your current branch that aren't upstream. See the git-tracks section below for details on how to change your upstream branch.

git-bz

Push commits from git to bugzilla. For example, to push the two top commits in your repository, run

git bz attach -e HEAD^^..

(This will complain if your commits don't mention the same bug number in their summaries.)

If a commit's message starts with "FOLD", it will be folded into the previous commit before pushing to bugzilla.

(Actually, git-bz can do more than push commits from git to bugzilla. But I don't use it for anything else, so I'm not sure which of the other features work with bugzilla.mozilla.org.)

git-new-workdir

Create a new working directory based off an existing local git repository.

git-tracks

Gets the name of the current branch's upstream branch. With -d or --default, git-tracks outputs "origin/master" if there's no upstream branch.

You can set this with git branch --set-upstream CURRENT_BRANCH UPSTREAM_BRANCH. (Don't do git branch --set-upstream BRANCH; that won't work right!)

Many other tools in this package use git tracks -d as your branch's "upstream branch".

git-to-hg-commit

Find the hg commit corresponding to a git commit.

git-push-to-hg

Usage: git push-to-hg [-t/--tip] PATH_TO_HG_REPO [GIT_REVS]

Push commits from git to a new qqueue in an hg repository. If GIT_REVS is omitted, push the commits $(git merge-base HEAD $(git-tracks))..HEAD (i.e. everything in the current branch that's not upstream).

If -t or --tip is specified, pull and update the hg repository to latest tip before pushing. Otherwise, update the hg repository to the revision atop which the git commits are based.

git-push-to-try

Usage: git push-to-try [-t/--tip] PATH_TO_HG_REPO TRYCHOOSER_PARAMS

Push the commits $(git merge-base HEAD $(git-tracks))..HEAD (i.e. everything in the current branch that's not upstream) to try, by way of the given hg repository.

TRYCHOOSER_PARAMS should be, e.g. -b do -p all -u all -t none.

git-push-to-trychooser

Usage: git push-to-trychooser [-t/--tip] PATH_TO_HG_REPO [GIT_REVS]

The same as git push-to-hg, but also runs the interactive trychooser command before pushing the commits to try from the given hg repository.

git-qparent

Outputs the last common revision of the current branch and upstream. (This command is a synonym for git merge-base HEAD $(git-tracks).)

git-qrebase

An alias for git rebase -i $(git qparent). This lets you interactively rebase your current branch without moving the commits to a new upstream base.

git-edit-files

Open all the files modified in the specified rev range in your $EDITOR. (If no rev range is specified, open the files modified in your current checkout.)

git-fix-whitespace

Eliminate any trailing whitespace from your uncommitted changes.

Note that this will reset your index; that is, any changes you've git add'ed will need to be added again. But it won't (or at least, shouldn't!) erase any changes.

git-qapplied

Like hg qapplied, output the commits in this branch which are not upstream.

git-patch-to-hg-patch

Format a patch from git format-patch as an hg patch.

git-branchname

Output the name of the active git branch, but if there's no git repository below the cwd, output nothing. This is useful when you want to display the current branch name on the command line.

For example, I have in my ~/.bashrc:

function vcs-branchname() {
  git_branch=`git branchname`
  if [[ "$git_branch" != "" ]]; then
    echo " ($git_branch)"
  fi
}

PROMPT_COLOR="35m"
PROMPT_COMMAND='BRANCH_NAME=`vcs-branchname`'
PS1='\[\033[01;$PROMPT_COLOR\]\u@\h\[\033[00m\]:\[\033[01;$PROMPT_COLOR\]\w\[\033[00m\]$BRANCH_NAME\$ '

which makes my prompt look like

jlebar@hostname:~/current/path (name-of-git-branch)$

pre-commit

A pre-commit hook which checks for .orig files and trailing whitespace.

To install this hook, symlink it into your repository's .git/hooks directory (with the name pre-commit).

Something went wrong with that request. Please try again.