@brettz9/git-utilities v1.7.0
git-utilities
Install
npm i @brettz9/git-utilitiesUse with Sourcetree
You can add to Sourcetree any or all of the following Custom actions (being
sure to change the /path/to portion to lead to where @brettz9/git-utilities is
hosted.
- Menu Caption: View File on Github (SHA commit)
- Script to run:
/path/to/@brettz9/git-utilities/bin/open-git-url.sh Parameters:
--sha=$SHA $REPO/$FILEMenu Caption: View File on Github (Latest on branch)
- Script to run:
/path/to/@brettz9/git-utilities/bin/open-git-url.sh Parameters:
$REPO/$FILEMenu Caption: Directory on Github (SHA commit)
- Script to run:
/path/to/@brettz9/git-utilities/bin/open-git-url.sh Parameters:
--type=directory --sha=$SHA $REPO/$FILEMenu Caption: Directory on Github (Latest on branch)
- Script to run:
/path/to/@brettz9/git-utilities/bin/open-git-url.sh Parameters:
--type=directory $REPO/$FILEMenu Caption: Raw File on Github (SHA commit)
- Script to run:
/path/to/@brettz9/git-utilities/bin/open-git-url.sh Parameters:
--type=raw --sha=$SHA $REPO/$FILEMenu Caption: Raw File on Github (Latest on branch)
- Script to run:
/path/to/@brettz9/git-utilities/bin/open-git-url.sh Parameters:
--type=raw $REPO/$FILEMenu Caption: Blame File on Github (SHA commit)
- Script to run:
/path/to/@brettz9/git-utilities/bin/open-git-url.sh Parameters:
--type=blame --sha=$SHA $REPO/$FILEMenu Caption: Blame File on Github (Latest on branch)
- Script to run:
/path/to/@brettz9/git-utilities/bin/open-git-url.sh Parameters:
--type=blame $REPO/$FILEMenu Caption: History File on Github (SHA commit)
- Script to run:
/path/to/@brettz9/git-utilities/bin/open-git-url.sh Parameters:
--type=history --sha=$SHA $REPO/$FILEMenu Caption: History File on Github (Latest on branch)
- Script to run:
/path/to/@brettz9/git-utilities/bin/open-git-url.sh Parameters:
--type=history $REPO/$FILEMenu Caption: Commit on Github (SHA commit, Unified diff)
- Script to run:
/path/to/@brettz9/git-utilities/bin/open-git-url.sh Parameters:
--type=commit --diff=unified --sha=$SHA $REPO/$FILEMenu Caption: Commit on Github (Latest on branch, Unified diff)
- Script to run:
/path/to/@brettz9/git-utilities/bin/open-git-url.sh Parameters:
--type=commit --diff=unified $REPO/$FILEMenu Caption: Commit on Github (SHA commit, Split diff)
- Script to run:
/path/to/@brettz9/git-utilities/bin/open-git-url.sh Parameters:
--type=commit --diff=split --sha=$SHA $REPO/$FILEMenu Caption: Commit on Github (Latest on branch, Split diff)
- Script to run:
/path/to/@brettz9/git-utilities/bin/open-git-url.sh Parameters:
--type=commit --diff=split $REPO/$FILEMenu Caption: Edit File on Github
- Script to run:
/path/to/@brettz9/git-utilities/bin/open-git-url.sh Parameters:
--type=edit $REPO/$FILEMenu Caption: Delete File on Github
- Script to run:
/path/to/@brettz9/git-utilities/bin/open-git-url.sh - Parameters:
--type=delete $REPO/$FILE
You can also add --branch=<branch> within the parameters to target a
specific branch.
(Note: to allow you to use your system path instead of hard-coding the paths above, you'd apparently need to follow one of the solutions at https://community.atlassian.com/t5/Bitbucket-questions/SourceTree-Hook-failing-because-paths-don-t-seem-to-be-set/qaq-p/274792 which create a wrapper application for Sourcetree that adds in path awareness.)
But the shell script at least will work without these solutions, as it
has the line source ~/.bash_profile.
Command line usage
open-git-url- You can run this by either a global npm install or within a requiring project'spackage.json.
Run -h to get the commands:
To-dos
- Add to tests and coverage
- Allow passing in cwd (or defaulting to
process.cwd()). - Refactor to make export which just returns the URL that would be used
- Document with some CLI examples
- Add various commit types and use in Sourcetree scripts
- Script to rebase all branches at a certain depth from a given commit (default 1?)
- Use
dialog-node(already in use for errors) to get further info for commit from user (e.g., branches to rebase ontomasteror a specific commit by SHA)
- Use
- See webappfind (AtYourCommand) for ideas of integration into Atom
- See https://github.com/tjunnone/npm-check-updates/issues/570; might
split up so as to also be able to query
npm view . repository(ornpm view <npm-pkg-name> repository) and use that as a base to check (viaHEADor API requests the presence of CHANGES files, releases (with text) licenses, etc.) and also to use npm packages for opening their Github commit history, etc. URLs.- Allow likes of ncu to choose a package by number, then querying it
(with an option to query old version?), e.g., to get CHANGES,
/commitsURL, main/treeURL, etc. (Would be like--interactivebut showing all by default and allowing actions after all listed, including, but not limited to, opportunity to update all.)
- Allow likes of ncu to choose a package by number, then querying it
(with an option to query old version?), e.g., to get CHANGES,
- Ensure working with global install (useful to be able to use on CL to open a Git URL from within the directory of a repo)
- Change to work with any Git site (allowing templates for URL building)
- Rename repo to reflect focus on opening? (using "git" and/or "npm" in name if adding npm support)