Skip to content

Commit 1d08735

Browse files
committed
chore: added possibility to specify maxBuffer
1 parent e6fab8d commit 1d08735

File tree

4 files changed

+23
-177
lines changed

4 files changed

+23
-177
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v7.10.1
1+
v16.19.0

README.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ List or remove local tracked branches, which are deleted from the remote.
44

55
Because I'm tired of doing every time `git fetch -p`, `git branch -r`, `git branch` and keep comparing which branches are gone from the GitHub, but still available locally and doing `git branch -D ${branch_name}` on one by one of them.
66

7-
## What does it do
7+
## What does it do?
88

99
This command will compare your local branches with remote and show you branches that are no longer available on remote but are still presented in your local repository. You can use it to view and delete all (remotely) removed branches in one go using `--prune` flag.
1010

@@ -19,19 +19,18 @@ This command works without the need to run `git fetch -p`, but a working network
1919
$ npm install -g git-removed-branches
2020
```
2121

22-
Please install a package globally with -g flag so that you can use it directly as a subcommand of git, like this:
22+
Please install a package globally with -g flag so that you can use it directly as a sub command of git, like this:
2323

2424
```bash
2525
$ git removed-branches
2626
```
2727

28-
### Python
28+
### NPX
2929

30-
It's also possible to use python instead of node.js/npm package.
31-
Download **git-removed-branches.py** script, remove the extension and place it inside your $PATH variable so that you can use it directly as a subcommand of git:
30+
It's also possible to use package through npx directly. Execute inside any git folder:
3231

3332
```bash
34-
$ git removed-branches
33+
$ npx git-removed-branches
3534
```
3635

3736
## Usage
@@ -43,6 +42,8 @@ $ git removed-branches
4342
This command will look through the branches that are no longer available on the remote and display them.
4443
In case you haven't run `git fetch -p`, it will warn you to do so.
4544

45+
This command is safe to run and it will not alter your repository.
46+
4647

4748
### Removing
4849

@@ -52,6 +53,8 @@ To delete local branches use `--prune` or `-p` flag
5253
$ git removed-branches --prune
5354
```
5455

56+
This command will compare your local branches to the remote ones and remove, those which do not exist anymore on the remote side.
57+
5558
### Different remote
5659

5760
If you have configured remote alias to something different than **'origin'**, you can use `--remote` or `-r` flag to specify the name of the remote. e.g., to specify remote to be `upstream`, you can use:
@@ -73,3 +76,14 @@ you can force deletion by using `--force` flag or use `-f` alias
7376
```bash
7477
$ git removed-branches --prune --force
7578
```
79+
80+
## Troubleshooting:
81+
82+
83+
If you encounter error `ERR_CHILD_PROCESS_STDIO_MAXBUFFER` it is possible that your repository contains too much branches, more then 3382. ( see [discussion](https://github.com/nemisj/git-removed-branches/issues/11) )
84+
85+
You can fix this, by specifying NODE_MAX_BUFFER environment variable, like:
86+
87+
```
88+
NODE_MAX_BUFFER=1048576 git removed-branches
89+
```

git-removed-branches.py

Lines changed: 0 additions & 169 deletions
This file was deleted.

lib/utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
const child_process = require('child_process');
22

3+
const maxBuffer = 'NODE_MAX_BUFFER' in process.env ? Number(process.env.NODE_MAX_BUFFER): undefined;
34
const exec = (argsArray, skipError) => {
45
return new Promise((resolve, reject) => {
5-
child_process.exec(argsArray.join(' '), (err, stdout, stderr) => {
6+
child_process.exec(argsArray.join(' '), { maxBuffer }, (err, stdout, stderr) => {
67
if (err) {
78
if (skipError) {
89
return resolve({ stdout, stderr });

0 commit comments

Comments
 (0)