Repository navigation
[Question] Documentation or Examples on Custom Actions #1448
Description
Activity
- addedquestionFurther information is requestedFurther information is requested
on Jun 23, 2025 Custom Actions can be created either in the global Preferences or just for a single repo (in the Repository Configure dialog).
A Custom Action can be setup for one of 3 different scopes:
- Repository (triggered via button in main toolbar, variable
${REPO}expands to current repo-path) - Branch (triggered by right-click on branch, variable
${BRANCH}expands to selected branch) - Commit (triggered by right-click on commit, variable
${SHA}expands to selected commit)
NOTE: The configured action-command is started in the repository root-folder (i.e
${REPO}).- Repository (triggered via button in main toolbar, variable
TIP: For interaction with remote GH-repos, GitHub CLI can be used from Custom Actions.
When contributing to SourceGit I use the following Custom Action, for quickly syncing my fork-repo (remote
origin) against the SourceGit main-repo (remoteupstream) without having to visit the repo-webpage (or do a reset & push on the local branch) :This basically does "Fast-forward origin/develop to upstream/develop".
(I added the--forceflag just to handle cases where theupstreambranch was force-pushed by a maintainer...) 😉FYI, as a spin-off from feature-request #1457, a new Input Controls feature (not yet released) was added for Custom Actions (along with new related variables
$1,$2, ...) :Additionally, a new
Scope-value ofTagwas added as a follow-up on feature-request #1457, along with a new related variable${TAG}:Maybe a new Discussion could be started, where we can post ideas / scripts etc for useful Custom Actions?
Reacted by Sina Hinderks and AlbertoV@love-linger @goran-w Many thanks for your comments.
I am trying to do a pull request from the command line but I'm having issues. At this moment I am not going to post it because I have to put in more effort (or dedicate more time) before I can ask something coherent.
Reacted by Göran WFYI, in #1466 there was added support for using the above mentioned scope-variables (
${REPO}etc) in theDefault:field when editing Custom Action Controls of typeTextBoxorPath Selector.Another tip not mentioned above (or documented anywhere?) : if your Custom Action is calling a script (for example a Git Bash script, as illustrated below), you can make SourceGit display an error/warning popup by doing BOTH of these things:
- Return a non-zero exit code from your script (
exit 1or similar). - Have your script output a suitable error/warning text to
stderr(viaecho "Message" >&2etc).
NOTE: Text that your script outputs to stdout (via
echo "Message" >&1etc) is not displayed anywhere immediately visible, but can be inspected after-the-fact from theView Logsfeature in SourceGit.Here's how to use Git Bash (on Windows) as the scripting engine (here using an absolute path to the bash executable, this could perhaps be improved) :
TIP: Text/filepath arguments could contain spaces, so it's a very good idea to enclose these in quotes...
- Return a non-zero exit code from your script (
Maybe a new Discussion could be started, where we can post ideas / scripts etc for useful Custom Actions?
@love-linger Maybe you (as maintainer) could simply use Convert Issue to Discussion on this issue, so it can be removed from the list of open Issues?
- Repository owner locked and limited conversation to collaborators
on Jul 1, 2025






Hi all,
I am looking for detailed documentation or examples on how to use
custom actionsin SourceGit. Specifically, I need guidance on the following areas:Additional Information
Context
I am working on a project where I need to extend SourceGit's functionality by adding custom actions. However, I have not found sufficient documentation or examples to guide me through the process.
Any help or pointers to relevant resources would be greatly appreciated!
Thank you!