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.
Works in GitTree Free: every local Git feature, once you are signed in.
On this page
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….
| Action | macOS | Windows and Linux |
|---|---|---|
| Preferences | ⌘, | Ctrl+, |
| The command palette | ⌘⇧P | Ctrl+Shift+P |
Steps
Add a command
In Custom Commands press Add Command, give it a Name, and choose the Program with Browse… or type its full path.
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.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.
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.