No description, website, or topics provided.
Clone or download
Pull request Compare This branch is 16 commits behind git-land:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This is a git extension that merges a pull request or topic branch via rebasing so as to avoid a merge commit. To merge a PR or branch, the script does the following:

  1. Fetch the latest target from the remote repository and reset your local target to match it.
  2. Check out the pull request or topic branch.
  3. Start an interactive rebase of the PR or topic branch on target.
  4. If merging a PR, append [close #<PR number>] to the last commit message so that Github will close the pull request when the merged commits are pushed.
  5. Fast-forward merge the rebased branch into target.
  6. Push target to the remote repository.


  • remote defaults to "origin" (configurable; see below)
  • target defaults to "master"


git land [<remote>] <pull request number>[:<target>]
git land [<remote>] <branch>[:<target>]


git land 123
git land my-topic-branch
git land origin 42:target-branch
git land origin feature-branch:target-branch


NPM (recommended)

You can install git-land using npm install.

npm install --global git-land

Manual Installation

Put the bash script in a folder that is in your PATH and make it executable. For example, to install it to ~/bin/, do the following:

curl -o ~/bin/git-land
chmod +x ~/bin/git-land

Repository setup

Before pull requests for a remote repository can be landed by number, the git remote for that repository must be configured to fetch pull requests as branches in your local fork. To do so, run the following command, replacing both occurences of origin with the name of the git remote if necessary.

git config --add remote.origin.fetch '+refs/pull/*/head:refs/remotes/origin/pr/*'


Remote repository

By default, git-land assumes the remote repository is pointed to by the git remote origin. To use a different default git remote, set the git-land.remote option. For example, to use a remote named upstream:

git config git-land.remote upstream

Target branch

By default, git-land merges the branch or pull request into master if no target branch is specified. To use a different default target branch, set the option. For example, to use a default target branch named dev:

git config dev


Thanks to @paulirish for git-open, from which I cribbed the format and some content for this README.



Copyright 2015 Bazaarvoice, Inc. Licensed under Apache 2.0