# @andreiled/git-bulk

> Perform operations on git repositories in bulk

Latest version **1.4.0** (published 2020-06-24) · 0 weekly downloads

## Install

```sh
npm install @andreiled/git-bulk
pnpm add @andreiled/git-bulk
yarn add @andreiled/git-bulk
bun add @andreiled/git-bulk
```

Provides the command `git-bulk`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2020-06-24 |
| First published | 2020-06-21 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 118.6 KB |
| Known vulnerabilities | 0 (+9 in 2 direct dependencies) |
| Install scripts | no |
| Author | Anthony Naddeo |
| Maintainers | andreiled |

## Links

- npm: https://www.npmjs.com/package/@andreiled/git-bulk
- Repository: https://github.com/andreiled/git-bulk
- Homepage: https://github.com/andreiled/git-bulk#readme
- Issues: https://github.com/andreiled/git-bulk/issues
- npm.io page: https://npm.io/package/@andreiled/git-bulk

## Dependencies (5)

- [colors](https://npm.io/package/colors.md) 1.1.2
- [commander](https://npm.io/package/commander.md) 2.9.0
- [immutable](https://npm.io/package/immutable.md) 3.7.6
- [simple-git](https://npm.io/package/simple-git.md) 1.25.0
- [merge-stream-in-chunks](https://npm.io/package/merge-stream-in-chunks.md) ^0.1.2

## Recent versions

- 1.4.0 (latest) — 2020-06-24
- 1.3.1 — 2020-06-21
- 1.3.0 — 2020-06-21
- 1.0.2 — 2020-06-21

## README

# Perform operations on git repositories in bulk

In the real world, we often work with multiple git repositories in a single
project. Changes may span across repositories and multitasking can force us to
manage branches across multiple repositories as well. The goal for this project
is to make managing changes and branches across multiple repositories easy.

At the moment, it makes assumptions based on my own workspaces: a project single
root with many repositories in a `src` folder. If you want to customize this
behavior then you can add a `.gitbulkconfig` file. See the Configuration section
below.

## Installation

git-bulk can be installed through npm.

```
npm install -g @andreiled/git-bulk
```

## Configuration

In the directory or directories where you intend to run `git bulk` from create a new `.gitbulkconfig` file in following format:
```
module.exports = {
    // Either define single root containing all repositories
    "repositoryRoot": "./projects"

    // Or define each repository explicitly
    'repositories': [

        // List multiple repositories using just their absolute paths
        './projects/Project1'

        // Or define additional properties for some or all of the repositories
        {
            name: 'ShortName',
            path: './projects/LongNameProject',
            group: 'front-end' }
    ]
}
```

## Operations <sub><sup>`git-bulk help <command>`</sup></sub>
These are the supported operations. It is assumed that `git-bulk` will be
executed from the project root. Most of these commands also support targeting subsets
of the repositories as well, which looks like `git-bulk status ./src/Repo1 ./src/Repo2 Repo3`.
Repository names can be specified as directory names or paths. For more information on these
commands, run `git-bulk help <command>`.

### `git-bulk help`
Show the help menu with a list of all possible operations.

### `git-bulk status`
Execute `git status` on all of the repositories that have any changes, where a
change can be modified files, committed files, or being ahead/behind of the
tracking branch. Names are color coded as well. Repository names will be green
when they have no uncommitted changes and they are ahead of the remote, blue
when there are uncommitted changes, and red when they are behind the remote.

### `git-bulk fetch`
Execute a `git fetch` on each of the git repositories. Each repository name will
be printed, along with whether it was successful or not.

### `git-bulk branch`
Execute a `git branch -v` on each of the git repositories.

### `git-bulk log`
Execute a `git log` on each of the git repositories. This will use a condensed,
custom graph view to display the log for each repo. Optionally pass `-n <number>`
to change the amount of commits displayed, and `-A` to show all branches at once.

### `git-bulk reset`
Execute a `git reset` on each git repository. You can pass a `-h` or `--hard` switch
as well.

### `git-bulk checkout`
Execute a `git checkout` on each git repository. Passing `-b branchName` is
mandatory. Passing a `-u branchName` option will also set a tracking branch when
creating branches. This will checkout the branch on the target packages, or
create it if it does not exist.

### `git-bulk rebase`
Execute a `git rebase` on each git repository. The rebase will only affect
repos with changes, unless the `-a` flag is given. If the `-i` flag is given,
then rebase will be run in interactive mode. Repo names/paths can also be specified to run
rebase on a subset of repos. The -a flag is still required, even when
specifying repo names manually that have no changes.

### `git-bulk exec`
Execute an arbitrary shell command specified using the `-c` argument on each git repository.
For example, to create a new feature branch in `origin` remote using `development` branch in `upstream` remote:
* on Linux and similar systems:
    ```
    git bulk exec -c 'git fetch upstream && git push origin upstream/development:refs/heads/feature/%FEATURE_NAME%'
    ```
* on Windows with `bash` available (e.g. Git Bash): 
    ```
    git bulk exec -c 'bash -c "git fetch upstream && git push origin upstream/development:refs/heads/feature/%FEATURE_NAME%"'
    ```

---
_Source: https://npm.io/package/@andreiled/git-bulk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
