Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

git town set-parent

git town set-parent [<branch>] [-v | --verbose]

The set-parent command moves a branch and all its children below another branch. Consider this stack:

main \ feature-1 \ * feature-2 \ feature-3 \ feature-A

Running git town set-parent feature-A creates this stack:

main \ feature-1 \ feature-A \ * feature-2 \ feature-3

You can also use set-parent to make a child branch a sibling branch. Consider this stack:

main \ feature-1 \ feature-2 \ * feature-3 \ feature-4

Running git town set-parent feature-1 creates this stack:

main \ feature-1 \ feature-2 \ * feature-3 \ feature-4

Since set-parent changes commits, your branches must be in sync when running this command. Run git town sync before running git town set-parent.

After set-parent runs, the affected branches no longer contain changes made by their old parents. However, they don’t see the changes made by their new parent branches yet. Please run git town sync to pull in changes from the new parents.

Positional argument

You can provide the name of the new parent for the current branch as an argument to this command. When called without arguments, queries the user for the new parent.

Options

-v
--verbose

The --verbose aka -v flag prints all Git commands run under the hood to determine the repository state.

--auto-resolve

Disables automatic resolution of phantom merge conflicts.

See also

  • detach extract the current branch from a stack, leaving its children in the stack.
  • swap move the current branch up in the stack