GIT-PHAB(1)

πŸ“¦ version 2.9.0~git20170531+6877964, in debian bookworm, ubuntu jammy, ubuntu noble

✨ NAME ✨

git-phab β€” it's the Git subcommand that hooks your repo up with phabricator πŸ¦‹ (yep, this is the GIT-PHAB(1) page, bestie, and it's about to be your new fave)


🌸 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 πŸ’–

okay so, it provides integration for projects using Phabricator 🌈 it's literally the lil bridge between your git repo and your Phabricator instance.

But listen β€” two things gotta be true first, no skipping:

  • your current repository must contain a valid .arcconfig file, and
  • a remote location to push submitted branches to has to be defined using:
git config phab.remote <remote>
if those aren't set up, bestie, nothing here is gonna work. set them up first πŸ™ˆ

πŸ‘‘ COMMANDS πŸ‘‘

attach

Creates a brand new differential for each commit in the <revision_range> you gave it πŸ’… Commit messages will be rewritten to include the URL of the newly created Differential β€” and no other information gets added to the message, fr fr. 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 you omit it, the default range is from the remote current branch's remote tracking commit to HEAD.

With the --task option, or if the 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. And if the phabricator instance supports the std:maniphest:git:uri-branch extention, the remote branch URI will be linked on the Maniphest ✨ iconic.

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. Wanna know how <revision_range> is formed? Go read the attach command, it's all there.

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.

heads up: this only fetch and print the commit id, it won't create or checkout a branch. like, at all. 😭

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, it 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 🧹 so satisfying, honestly.

land

Same as git push but for each commit that would be pushed, it queries who approved its differential and adds the corresponding Reviewed-by: line πŸ’–

Ngl, 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 🫢 (stored!! so it remembers!! we love a memory queen)

For each related tasks, it also prompts 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

and that's the whole page, bestie πŸ’œ this one's from 03/11/2021, and yeah β€” it's the GIT-PHAB(1) manual, so you already know it ate. go forth and attach some differentials βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from