@rnx-kit/tools-git
v0.1.1
Published
A collection of functions for common Git operations
Keywords
Readme
@rnx-kit/tools-git
🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧
THIS TOOL IS EXPERIMENTAL — USE WITH CAUTION
🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧
A collection of functions for common Git operations.
Installation
yarn add @rnx-kit/tools-git --devor if you're using npm
npm add --save-dev @rnx-kit/tools-gitUsage
import { getBaseCommit, getChangedFiles } from "@rnx-kit/tools-git";
const baseCommit = getBaseCommit("origin/main");
if (baseCommit) {
for (const file of getChangedFiles(baseCommit)) {
// ...
}
}| Category | Function | Description |
| -------- | --------------------------------------- | ----------------------------------------------------------- |
| branch | getBaseCommit(targetBranch, fallback) | Returns the commit that the current branch forked off. |
| branch | getDefaultBranch(fallback) | Returns the default branch for the current repository. |
| diff | getChangedFiles(since) | Returns all files that changed since a given branch/commit. |
| git | git(...args) | Executes git with specified arguments. |
| ref | verifyRef(ref) | Returns whether the specified reference name is valid. |
