Skip to content
GitTree
Files and tools

Create and run custom actions

Custom commands run your own programs on a repository from the Custom actions button and from commit, branch and file menus. Each argument is passed exactly as written, no shell is involved, and the first run of a command shows exactly what will run before it does.

FreeUpdated

Works in GitTree Free: every local Git feature, once you are signed in.

On this page
  1. Before you start
  2. Where to find it
  3. Steps
  4. Expected result
  5. How commands run
  6. If something goes wrong
  7. Questions
  8. Related

Before you start

  • The program you want to run is installed, and you know its full path.

Where to find it

  • Preferences › External Tools › Custom Commands to add them.
  • The Custom actions button in the toolbar, the Custom Commands menu on a commit, branch or file, or the palette: Run Custom Command….
ActionmacOSWindows and Linux
Preferences⌘,Ctrl+,
The command palette⌘⇧PCtrl+Shift+P

Steps

  1. Add a command

    In Custom Commands press Add Command, give it a Name, and choose the Program with Browse… or type its full path.

  2. Add its arguments

    Press Add Argument for each one. Use {repo} (the working folder), {branch}, {sha} or {file} where GitTree should fill one in. Tick Ask before every run if it should always ask. Press Save Commands.

  3. Run it

    Choose it from Custom actions or from a branch, commit or file menu. The first time, GitTree lists the program and each argument under Program and arguments, and the folder it Runs in; press Run.

  4. Read the output

    The window shows Output and Messages and says it finished or failed with its exit code. Stop ends a long run.

Expected result

Your command ran on the repository, branch, commit or file you chose, and you saw what it printed.

How commands run

  • Each argument field is one argument: spaces and quotes need no escaping. Nothing is run by a shell, so pipes and && do not work; point the program at a script instead.
  • A command runs only when you choose it. A command you change shows its check again on the next run.
  • A command that needs {branch}, {sha} or {file} runs only from a menu that has one.

If something goes wrong

“None of your custom commands can run here.”

Their arguments need a branch, a commit or a file: run them from that item’s menu.

Questions

Can a custom command use my shell aliases?

No, because no shell runs it. Use bash, zsh or pwsh as the program and your script as its argument.