---
name: "git-phab"
section: "1"
platform: "linux"
package: "git-phab"
version: "2.9.0~git20170531+6877964-2"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/git-phab"
---

# git-phab(1)

Git subcommand to integrate with phabricator.

## NAME

git-phab - Git subcommand to integrate with phabricator.

## SYNOPSIS

```
git phab attach [-h] [--reviewers <username1,#project2,...>]
                [--cc <username1,#project2,...>] [--message <message>]
                [--task <T123>] [--remote <remote>] [--assume-yes]
                [--projects <project1,project2,...>]
                [<revision range>]
git phab log [-h] [<revision range>]
git phab fetch [-h] [<T123>]
git phab apply [-h] [<(T|D)123>] [-n] [-o <directory>]
git phab browse [-h] [objects [objects ...]]
git phab clean [-h]
git phab land [-h] [--no-push]
```

## DESCRIPTION

Provides integration for projects using Phabricator.

The current repository must contain a valid .arcconfig file and a remote location to push submitted branches must be defined using:

```
git config phab.remote <remote>
```

## COMMANDS

**attach**

Creates a new differential for each commit in the provided *\<revision\_range\>*. Commit messages will be rewritten to include the URL of the newly created Differential (no other information will be added to the message). If a commit message already contains the URL of a Differential it will be updated instead of creating a new one.

*\<revision\_range\>* can be either a range of commits or a single commit, as understood by git rev-parse. If omitted, the default range is from the remote current branch’s remote tracking commit to HEAD.

With --task option, or if current branch is in the form Txxx-description, it will also push the current HEAD into wip/phab/Txxx-description on the configured remote repository. If the phabricator instance supports the std:maniphest:git:uri-branch extention, the remote branch URI will be linked on the Maniphest.

If not task is defined, it will prompt if a new one should be created.

If a task is defined but the current branch is not in the form Txxx-description, it will prompt if a new branch must be created using current branch’s name prefixed with Txxx-.

**log**

Prints all commits in the provided \<revision\_range\>. For each commit it displays the Differential ID and its current status. See the *attach* command for details on how *\<revision\_range\>* is formed.

**fetch**

Fetch the branch linked to a Maniphest task. With no argument the task will be defined from the current branch name, if it is in the form Txxx-description.

This only fetch and print the commit id, it won’t create or checkout a branch. A new branch can then be created using, for example:

```
git checkout -b my-branch FETCH_HEAD
```

With --checkout (or -c), fetch and checkout in a branch.

**apply**

Apply a revision and its dependencies.

With --no-dependencies (or -n), revision’s dependencies will not be applied.

With --output-directory (or -o), patches aren’t applied to the repository, but exported to a directory instead.

**browse**

Open related URIs in a web browser using **xdg-open**.

With no argument, if the current branch is in the form Txxx-description, opens that Maniphest task.

If objects is in the form *Dxxx*/*Txxx* it will open the corresponding Differential/Maniphest. Otherwise it is assumed that object is a commit as understood by git rev-parse and if that commit contains a link to a Differential it will be open.

**clean**

For all local and remote references, if they are in the form Txxx-description and the corresponding task has been closed, prompt if that branch should be removed.

**land**

Same as git push but for each commit that would be pushed, query who approved its differential and add corresponding *Reviewed-by:* line. Note that the email address is guessed by looking the reviewer’s fullname into git shortlog. If the fullname cannot be found it will be asked then stored into ~/.config/git/phab so it won’t be prompted again.

For each related tasks, also prompt if it should be closed.

## EXAMPLES

Attach all commits since origin/master

```
$ git phab attach
```

Attach only the top commit

```
$ git phab attach HEAD
```

Attach all commits since origin/master, excluding top commit

```
$ git phab attach origin/master..HEAD^
```

Attach top 3 patches, link them to a task, and set reviewers

```
$ git phab attach --reviewers xclaesse,smcv --task T123 HEAD~3..
```

Push current branch to origin/wip/phab/T123

```
$ git config phab.remote origin
$ git phab attach --task T123
```

Fetch a branch associated with the task T123

```
$ git phab fetch T123
```
