Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@brettz9/git-utilities

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@brettz9/git-utilities

CLI utility scripts for Git

latest
Source
npmnpm
Version
1.7.0
Version published
Maintainers
1
Created
Source

git-utilities

Install

npm i @brettz9/git-utilities

Use 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/$FILE

  • Menu Caption: View File on Github (Latest on branch)

  • Script to run: /path/to/@brettz9/git-utilities/bin/open-git-url.sh

  • Parameters: $REPO/$FILE

  • Menu 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/$FILE

  • Menu Caption: Directory on Github (Latest on branch)

  • Script to run: /path/to/@brettz9/git-utilities/bin/open-git-url.sh

  • Parameters: --type=directory $REPO/$FILE

  • Menu 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/$FILE

  • Menu 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/$FILE

  • Menu 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/$FILE

  • Menu 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/$FILE

  • Menu 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/$FILE

  • Menu 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/$FILE

  • Menu 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/$FILE

  • Menu 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/$FILE

  • Menu 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/$FILE

  • Menu 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/$FILE

  • Menu Caption: Edit File on Github

  • Script to run: /path/to/@brettz9/git-utilities/bin/open-git-url.sh

  • Parameters: --type=edit $REPO/$FILE

  • Menu 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's package.json.

Run -h to get the commands:

doc-includes/cli.svg

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 onto master or a specific commit by SHA)
  • 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 (or npm view <npm-pkg-name> repository) and use that as a base to check (via HEAD or 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, /commits URL, main /tree URL, etc. (Would be like --interactive but showing all by default and allowing actions after all listed, including, but not limited to, opportunity to update all.)
  • 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)

Keywords

git

FAQs

Package last updated on 08 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts