git town ship
git town ship [--to-parent] [--message <text>] [branch-name]
Notice: Most people don't need to use the ship command. The recommended way
to merge your feature branches is to use the web UI or merge queue of your code
hosting service, as you would normally do. git ship
is for edge cases like
developing in offline mode or when shipping
stacked changes.
The ship command ("let's ship this feature") merges a completed feature branch into the main branch and removes the feature branch.
The branch to ship must be in sync. If it isn't in sync, git ship
will exit
with an error. When that happens, run git sync to get the branch in
sync, re-test and re-review the updated branch, and then run git ship
again.
Positional argument
When called without a positional argument, the ship command ships the current branch.
When called with a positional argument, it ships the branch with the given name.
--dry-run
The --dry-run
flag allows to test-drive this command. It prints the Git
commands that would be run but doesn't execute them.
--message / -m
Similar to git commit
, the --message <message>
aka -m
parameter allows
specifying the commit message via the CLI.
--to-parent / -p
The ship command ships only direct children of the main branch. To ship a
child branch, you need to first ship or kill all its ancestor
branches. If you really want to ship into a non-perennial branch, you can
override the protection against that with the --to-parent
aka -p
option.
--verbose / -v
The --verbose
aka -v
flag prints all Git commands run under the hood to
determine the repository state.
Configuration
The configured ship-strategy determines how the ship command merges branches. When shipping stacked changes, use the fast-forward ship strategy to avoid empty merge conflicts.
If you have configured the API tokens for GitHub, GitLab, or Gitea and the branch to be shipped has an open proposal, this command merges the proposal for the current branch on your origin server rather than on the local Git workspace.
If your origin server deletes shipped branches, for example GitHub's feature to automatically delete head branches, you can disable deleting remote branches.