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 walk

git town walk [<command and arguments>] [-a | --all] [--dry-run] [-h | --help] [--(non)-interactive] [-s | --stack] [-v | --verbose]

The walk command (“walking the branch hierarchy”) runs a given command for all feature branches in your current stack or the entire repo. Git Town checks out each branch, executes the command, and then moves to the next branch. If the command fails or leaves uncommitted changes behind, git town walk stops so you can fix the problem or commit the generated changes before continuing.

If no shell command is provided, drops you into an interactive shell for each branch. You can manually run any shell commands, then proceed to the next branch with git town continue

Examples

Consider this stack:

main
 \
  branch-1
   \
*   branch-2
     \
      branch-3

Running git town walk --stack make lint produces this output:

[branch-1] make lint
# ... output of "make lint" for branch-1

[branch-2] make lint
# ... output of "make lint" for branch-2

[branch-3] make lint
# ... output of "make lint" for branch-3

Options

-a
--all

Iterate through all local branches.

--dry-run

Test-drive this command: It prints the commands that would be run but doesn’t execute them.

-h
--help

Display help for this command.

--interactive
--non-interactive

Enables or disables interactive dialogs.

-s
--stack

Iterate through all branches of the stack that the current branch belongs to.

-v
--verbose

Print all Git commands executed under the hood to determine the repository state.

See also

  • branch displays the branch hierarchy and highlights the currently checked out branch in it
  • switch displays the branch hierarchy and lets you select a branch to switch to