Git Product home page Git Product logo

portablegit.js's Introduction

PortableGit via npm

๐Ÿ”„ Redistribution of Git for Windows's PortableGit

npx -p portablegit git add --all
npx -p portablegit git commit --message "Hello world!"
npx -p portablegit bash -c "grep version package.json"
npx -p portablegit sh ./build.sh
npx -p portablegit git-bash
npx -p portablegit gitk HEAD

๐Ÿ”ถ Use Git for Windows via npm
๐Ÿ‘จโ€๐Ÿ’ป Provides bash via Git Bash
๐Ÿ’พ Uses a portable installation of Git & Bash
๐ŸŸฆ Only works on Windows
๐Ÿงฐ Useful when you need a specific Git version

Installation

npm pnpm Yarn Bun Windows

You can install this package using npm or your favorite npm package manager. If possible you should use the user or global Git for Windows installation instead of this package.

npm install --save-dev portablegit

โš ๏ธ It's not recommended to install this package globally! Install Git for Windows normally on your system instead. Interested in installing Git globally on more that just Windows machines? Check out Git - Installing Git.

๐Ÿ›‘ Only works on Windows x64 systems. Does not work on macOS or Linux.

โ„น There is no JavaScript component to this package; it's just a redistribution of the various PortableGit files and binaries.

Usage

Windows

You can use this package just as you would any other npm package that provides binaries! It's just that these binaries are Windows-specific. ๐Ÿคทโ€โ™‚๏ธ

npx portablegit --version
#=> git version 2.X.Y.windows.Z

Available binary commands exposed through this npm package are:

  • bash: Git Bash bash.exe. Useful for cross-platform scripting. You can run Bash scripts on Windows!
  • sh: Git Bash sh.exe. Runs bash.exe in POSIX mode.
  • git: The actual git.exe binary for Windows. See the Git website to learn more about Git.
  • git-bash: Launches a terminal emulator running Git Bash. Uses MinTTY.
  • git-cmd: Starts a cmd.exe subshell preloaded with git.exe and other things in $PATH. Does not launch a new window.
  • git-gui: Starts the Git GUI.
  • gitk: Starts the GitK GUI.

You can import.meta.resolve() or require.resolve() anything that would normally be in the extracted PortableGit/* folder. Here's an example:

const cat = import.meta.resolve("portablegit/usr/bin/cat.exe");
console.log(cat);
//=> 'file:///C:/Users/you/Documents/myproject/node_modules/portablegit/out/portablegit/usr/bin/cat.exe'

const cut = require.resolve("portablegit/usr/bin/cut.exe");
console.log(cut);
//=> 'C:\\Users\\you\\Documents\\myproject\\node_modules\\portablegit\\out\\portablegit\\usr\\bin\\cut.exe'

This can be useful if you need to resolve the path to a specific binary (cat.exe, cut.exe, etc.) that isn't exposed by default.

Development

Node.js GitHub Actions

You'll need a Windows computer to test this package locally. You can run npm run build to make sure everything looks good locally. There are some CI automation scripts to auto-release on new Git for Windows releases. It's all automated! ๐Ÿค– Check out the gh-release-createworkflow to see how it works.

portablegit.js's People

Contributors

github-actions[bot] avatar jcbhmr avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.