Skip to content

Command Line Arguments

tchap edited this page Apr 10, 2013 · 22 revisions

(version 0.4.1)

Initialize

git flow init [-fd]

-d, --defaults use default branch names

-f, --force force

Initialize a new git repo with support for the branching model.

Uses remote services: NO.

The initialisation goes through the following steps:

  1. If the repository is already initialised, exit unless -f is specified.
  2. If -d is specified, use the well-known branch names and branch name prefixes as defined in GitFlow, otherwise ask the user what names and prefixes to use.
  3. Use git config to remember the configuration. This means that the configuration is tied to your particular repository instance.

Feature

git flow feature [list] [-v]

-v, --verbose verbose (more) output, i.e. show more information about the state of the branch, compare it to its merge base, check if it can be rebased etc.

Lists existing features.

Uses remote services: NO.

git flow feature start [-F] <name> [<base>]

-F, --fetch fetch from $ORIGIN before performing local operation

Start new feature <name>, optionally basing it on <base> instead of <develop>.

Uses remote services: YES.

This commands involves some Pivotal Tracker API calls. The user is not allowed to create arbitrary branch, he must choose one of the stories that are present in the Pivotal Tracker project assigned to the repository. It goes through following steps:

  1. Download Current and Backlog from the Pivotal Tracker project assigned to this repository.
  2. Ask user to choose one of the stories present in Current or Backlog.
  3. Once a story is picked up, the user is asked to append a human-readable branch description.
  4. The new branch name is <feature-prefix>/<story-id>/<description>.
  5. The story is marked as Started in Pivotal Tracker.
  6. The branch is created in the repository.

Since this commands ALWAYS connects to Pivotal Tracker, it does not work offline.

git flow feature finish [-rFk] <name|nameprefix>

-r, --rebase rebase instead of merge

-n, --new-review post a new review for the whole branch, not just the last commit

-R, --no-review do not post any code review request

-P, --no-push do not push the branch upstream

-D, --force-delete force delete the branch once finished

Finish feature <name>.

Uses remote services: YES.

Use this command to finish the story, i.e. mark the branch as finished, mark the story as finished in Pivotal Tracker, post a code review request into Review Board. The whole procedure works in the following way:

  1. Get the branch name or use the current branch.
  2. Finish the feature branch, i.e. fetch -> merge -> push (can be modified using the command line options).
  3. Extract the story id from the branch name.
  4. Annotate the branch in Git so that we know the story is being finished. Push the notes upstream.
  5. Call the PT API and mark the story as finished.
  6. Call the RB API and post a review request unless configured to skip this step.

Since this commands ALWAYS connects to Pivotal Tracker, it does not work offline. It also MAY connect to Review Board and push changes upstream.

git flow feature publish <name>

Start sharing feature <name> on $ORIGIN.

Uses remote services: YES.

This is roughly equivalent to git push -u $ORIGIN $BRANCH where BRANCH=<feature-prefix>/<name>.

git flow feature track <name>

Start tracking feature <name> that is shared on $ORIGIN.

Uses remote services: NO.

This is roughly equivalent to git branch -u $ORIGIN/$BRANCH $BRANCH where BRANCH=<feature-prefix>/<name>. In the older git (pre-1.8.0), the command is in fact git branch --set-upstream $BRANCH $ORIGIN/$BRANCH.

git flow feature diff [<name|nameprefix>]

Show all changes in <name> that are not in <develop>.

Uses remote services: NO.

This is equivalent to git diff $DEVELOP_BRANCH $BRANCH where BRANCH=<feature-prefix>/<name>.

git flow feature rebase [-i] [<name|nameprefix>]

-i do an interactive rebase

Rebase <name> on <develop>

Uses remote services: NO.

Syntactic sugar for git checkout $BRANCH; git rebase -i $DEVELOP_BRANCH where BRANCH=<feature-prefix>/<name>.

git flow feature checkout [<name|nameprefix>]

Switch to feature branch <name>

Uses remote services: NO.

Syntactic sugar for git checkout $BRANCH where BRANCH=<feature-prefix>/<name>.

git flow feature pull <remote> [<name>]

Pull feature <name> from <remote>

Uses remote services: YES.

Syntactic sugar for git pull $REMOTE $BRANCH where BRANCH=<feature-prefix>/<name>. It also checks that you are not trying to merge non-matching branches together, an example of which could be:

  1. git flow feature checkout cool-feature
  2. git flow feature pull origin other-cool-feature

That would normally result in merging $REMOTE/other-cool-feature into cool-feature, which you probably don't want, but you need not worry, you are not allowed to do that if you use this tool.

Release

git flow release [list] [-v]

-v verbose (more) output

Lists existing releases

git flow release start [-F] <version>

-F fetch from $ORIGIN before performing local operation

Start new release named <version>

git flow release list_stories <version>

Go through Pivotal Tracker and list all stories assigned to the chosen release.

git flow release finish [-Fsumpkn] <version>

-F fetch from $ORIGIN before performing finish

-s sign the release tag cryptographically

-u use the given GPG-key for the digital signature (implies -s)

-m use the given tag message

-p push to $ORIGIN after performing finish

-k keep branch after performing finish

-n don't tag this release

Finish release <version>

git flow release publish <name>

Start sharing release <name> on $ORIGIN

git flow release track <name>

Start tracking release <name> that is shared on $ORIGIN

Hotfix

git flow hotfix [list] [-v]

-v verbose (more) output

Lists existing hotfixes

git flow hotfix start [-F] <version> [<base>]

-F fetch from $ORIGIN before performing local operation

Start new hotfix named <version>, optionally base it on <base> instead of <master>

git flow hotfix finish [-Fsumpkn] <version>

-F fetch from $ORIGIN before performing finish

-s sign the release tag cryptographically

-u use the given GPG-key for the digital signature (implies -s)

-m use the given tag message

-p push to $ORIGIN after performing finish

-k keep branch after performing finish

-n don't tag this release

Finish hotfix <version>

Support

git flow support [list] [-v]

-v verbose (more) output

Lists existing support branches

git flow support start [-F] <version> <base>

-F fetch from $ORIGIN before performing local operation

Start new support branch named <version> based on <base>

Configuration

Setting a different remote repo

A remote repo different from origin can be specified in the config file:

$ git config gitflow.origin myorigin