Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rogeriopradoj/sourcetree-custom-actions-scripts
The commands I'm using to complement SourceTree via Custom Actions
https://github.com/rogeriopradoj/sourcetree-custom-actions-scripts
bash git sourcetree
Last synced: about 13 hours ago
JSON representation
The commands I'm using to complement SourceTree via Custom Actions
- Host: GitHub
- URL: https://github.com/rogeriopradoj/sourcetree-custom-actions-scripts
- Owner: rogeriopradoj
- License: mit
- Created: 2017-02-02T11:29:35.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-05-12T06:53:22.000Z (6 months ago)
- Last Synced: 2024-05-12T18:27:19.581Z (6 months ago)
- Topics: bash, git, sourcetree
- Language: Batchfile
- Size: 97.7 KB
- Stars: 14
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SourceTree Custom Actions
The commands I'm using to complement SourceTree via Custom Actions
![Command list in 2023-05-30](scripts-list.png)
## Installation
Change your current directory to `$HOME/Library/Application Support/SourceTree/`:
```shell
# macos
cd "$HOME/Library/Application Support/SourceTree/"# or, in Windows
# cd "%USERPROFILE%\AppData\Local\Atlassian\SourceTree\"
```So, git clone (or download) this repository there:
```shell
git clone \
https://github.com/rogeriopradoj/sourcetree-custom-actions-scripts.git \
scripts
```Then, go to SourceTree, `Preferences -> Custom Actions -> Add`, filling the options like this:
- **Menu Caption**: a custom name for that action;
- **[x] Show Full Ouput**: mark it;
- **Script to run**: navigate to `$HOME/Library/Application Support/SourceTree/scripts` folder (in macos or, in Windows, `%USERPROFILE%\AppData\Local\Atlassian\SourceTree\`) and pick the one you are setting up;And it's done! Remember that you need to do this process to each of the scripts you want to use as a Custom Action in your machine.
### Updating
You can download latest zip, or run the following command:
```shell
# macos
CWD=`pwd` && \
cd "$HOME/Library/Application Support/SourceTree/scripts" && \
git pull && \
cd $CWD# or, in Windows
# set "CWD=%CD%" & cd /d "%USERPROFILE%\AppData\Local\Atlassian\SourceTree\scripts" & git pull & cd /d "%CWD%"
```So, you get the latest versions of the scripts.
## Usage
While working in your repositories as normal in SourceTree, go to `Actions -> Custom Actions` and pick the one you want to use.
### Extra - Usage via CLI
I suggest you adding the folder `$HOME/Library/Application Support/SourceTree/scripts/bin` in your `$PATH` environment variable (in macos or, in Windows, `%USERPROFILE%\AppData\Local\Atlassian\SourceTree\` to `%PATH%`). This way, you can use the same scripts via CLI just calling script name, instead of needing to type the full path to each script.
In case you are using `bash` as your shell, you can do this:
```shell
echo \
'export PATH=$PATH:"$HOME/Library/Application Support/SourceTree/scripts/bin"' \
>> ~/.bashrc && \
source ~/.bashrc
```Otherwise, here is the syntax if your shell is `zsh`:
```shell
echo \
'export PATH=$PATH:"$HOME/Library/Application Support/SourceTree/scripts/bin"' \
>> ~/.zshrc && \
source ~/.zshrc
```Remember to make scripts executable:
```shell
find "$HOME/Library/Application Support/SourceTree/scripts/bin/" -type f -print0 | xargs -0 chmod +x
```After that, you can run any of the scripts via CLI no matter inside what directory you are, example of running `git-push-master-to-all-remotes`
```shell
cd PATH_TO_ANY_GIT_PROJECT
#
git-push-master-to-all-remotes
# or
git push-master-to-all-remotes
```