acp-push 1.4.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +112 -112
- package/bin/acp.js +573 -552
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,112 +1,112 @@
|
|
|
1
|
-
# acp-push
|
|
2
|
-
|
|
3
|
-
Stage, commit and push in one command.
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
acp
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
runs:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
git add .
|
|
13
|
-
git commit -m "<one of 25 random messages>"
|
|
14
|
-
git push origin HEAD:main
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
`HEAD:main` means your current local branch (whether it's called `main`, `master` or anything else) is pushed to `main` on the remote.
|
|
18
|
-
|
|
19
|
-
## Install
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
npm install -g acp-push
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Options
|
|
26
|
-
|
|
27
|
-
| Flag | Description |
|
|
28
|
-
| --- | --- |
|
|
29
|
-
| `-u`, `--upstream` | Push to `origin`, then open a pull request to `upstream` |
|
|
30
|
-
| `-ua`, `--upstream-merge` | Same as `-u`, then merge the pull request if you have write access to `upstream` |
|
|
31
|
-
| `-b`, `--branch <name>` | Push to `<name>` instead of `main` |
|
|
32
|
-
| `-m`, `--message <text>` | Use your own commit message instead of a random one |
|
|
33
|
-
| `-c`, `--chunks` | Split your changes into 10 smaller commits (by change, not by file), then push |
|
|
34
|
-
| `-h`, `--help` | Show help |
|
|
35
|
-
| `-v`, `--version` | Show version |
|
|
36
|
-
|
|
37
|
-
## Examples
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
acp # git push origin main
|
|
41
|
-
acp -u # git push origin main, then open a PR to upstream
|
|
42
|
-
acp -ua # same, then merge the PR if you have write access
|
|
43
|
-
acp -b dev # git push origin dev
|
|
44
|
-
acp --branch=dev # same as above
|
|
45
|
-
acp -u -b fix # git push origin fix, then open a PR to upstream
|
|
46
|
-
acp -m "Fix login bug" # custom message
|
|
47
|
-
acp -c # 10 smaller commits, then push
|
|
48
|
-
acp -c -ua # 10 commits, each pushed with its own PR, merged right away
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Pull requests to upstream
|
|
52
|
-
|
|
53
|
-
If `origin` is your fork and `upstream` is the original repo, `acp -u` pushes to your fork and opens a pull request:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
git add .
|
|
57
|
-
git commit -m "<one of 25 random messages>"
|
|
58
|
-
git push origin HEAD:main
|
|
59
|
-
gh pr create --repo <upstream owner>/<repo> --head <your account>:main
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
`acp -ua` does the same and then merges it with `gh pr merge --merge`, but only if your account has write access to `upstream` (the write, maintain or admin role). Without it, the pull request is left open for a maintainer and `acp` still finishes successfully.
|
|
63
|
-
|
|
64
|
-
- You need the [GitHub CLI](https://cli.github.com) (`gh`) and a remote called `upstream`. Add one with `git remote add upstream <url>`. Both remotes must be GitHub repos.
|
|
65
|
-
- The pull request goes into the default branch of `upstream`. Its title is your last commit message.
|
|
66
|
-
- If a pull request from that branch is already open, the push updates it and `acp` doesn't open a second one. `-ua` merges the open one.
|
|
67
|
-
- For the merge, `acp` checks two `gh` accounts for write access: the one named like the owner of `upstream` (if you're logged in to it), then the one that opened the pull request. It merges with the first that has it.
|
|
68
|
-
- If the merge fails, the pull request stays open and `acp` prints its link.
|
|
69
|
-
|
|
70
|
-
## Multiple GitHub accounts
|
|
71
|
-
|
|
72
|
-
If you have the [GitHub CLI](https://cli.github.com) (`gh`) installed, `acp` picks the right account for each repo automatically:
|
|
73
|
-
|
|
74
|
-
| Remote | Account used |
|
|
75
|
-
| --- | --- |
|
|
76
|
-
| `https://github.com/SENODROOM/acp-push` | `SENODROOM` |
|
|
77
|
-
| `https://github.com/Gobibahu/some-repo` | `GobiBahu` (names are case-insensitive) |
|
|
78
|
-
| `https://github.com/some-org/project` (no matching account) | the account you used last |
|
|
79
|
-
|
|
80
|
-
Log in to each account once:
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
gh auth login # log in as the first account
|
|
84
|
-
gh auth login # run again for the second account
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
`acp` switches gh's active account to whichever one it used, so "last used" is always the most recent one. The token is only used for that one push and doesn't replace your saved git login. SSH remotes and non-GitHub remotes use your normal git login.
|
|
88
|
-
|
|
89
|
-
## git-multi-commit projects
|
|
90
|
-
|
|
91
|
-
If your repo root contains a `.git-multi-commit.json` file (created by [`git-multi-commit --config`](https://www.npmjs.com/package/git-multi-commit)), `acp` still runs `git add .` and `git commit` locally, but then runs `git-multi-commit` instead of `git push`:
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
git add .
|
|
95
|
-
git commit -m "<one of 25 random messages>"
|
|
96
|
-
git-multi-commit
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
No `origin` remote is needed in this case
|
|
100
|
-
|
|
101
|
-
## Notes
|
|
102
|
-
|
|
103
|
-
- If there is nothing new to commit, `acp` skips the commit and still pushes, so any commits you made earlier get sent.
|
|
104
|
-
- `-b <name>` pushes your current local branch to `<name>` on the remote, creating it there if it doesn't exist yet.
|
|
105
|
-
|
|
106
|
-
## Custom messages
|
|
107
|
-
|
|
108
|
-
Edit the list in `lib/messages.js`.
|
|
109
|
-
|
|
110
|
-
## License
|
|
111
|
-
|
|
112
|
-
MIT
|
|
1
|
+
# acp-push
|
|
2
|
+
|
|
3
|
+
Stage, commit and push in one command.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
acp
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
runs:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
git add .
|
|
13
|
+
git commit -m "<one of 25 random messages>"
|
|
14
|
+
git push origin HEAD:main
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`HEAD:main` means your current local branch (whether it's called `main`, `master` or anything else) is pushed to `main` on the remote.
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install -g acp-push
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Options
|
|
26
|
+
|
|
27
|
+
| Flag | Description |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| `-u`, `--upstream` | Push to `origin`, then open a pull request to `upstream` |
|
|
30
|
+
| `-ua`, `--upstream-merge` | Same as `-u`, then merge the pull request if you have write access to `upstream` |
|
|
31
|
+
| `-b`, `--branch <name>` | Push to `<name>` instead of `main` |
|
|
32
|
+
| `-m`, `--message <text>` | Use your own commit message instead of a random one |
|
|
33
|
+
| `-c`, `--chunks` | Split your changes into 10 smaller commits (by change, not by file), then push |
|
|
34
|
+
| `-h`, `--help` | Show help |
|
|
35
|
+
| `-v`, `--version` | Show version |
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
acp # git push origin main
|
|
41
|
+
acp -u # git push origin main, then open a PR to upstream
|
|
42
|
+
acp -ua # same, then merge the PR if you have write access
|
|
43
|
+
acp -b dev # git push origin dev
|
|
44
|
+
acp --branch=dev # same as above
|
|
45
|
+
acp -u -b fix # git push origin fix, then open a PR to upstream
|
|
46
|
+
acp -m "Fix login bug" # custom message
|
|
47
|
+
acp -c # 10 smaller commits, then push
|
|
48
|
+
acp -c -ua # 10 commits, each pushed with its own PR, merged right away
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Pull requests to upstream
|
|
52
|
+
|
|
53
|
+
If `origin` is your fork and `upstream` is the original repo, `acp -u` pushes to your fork and opens a pull request:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
git add .
|
|
57
|
+
git commit -m "<one of 25 random messages>"
|
|
58
|
+
git push origin HEAD:main
|
|
59
|
+
gh pr create --repo <upstream owner>/<repo> --head <your account>:main
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`acp -ua` does the same and then merges it with `gh pr merge --merge`, but only if your account has write access to `upstream` (the write, maintain or admin role). Without it, the pull request is left open for a maintainer and `acp` still finishes successfully.
|
|
63
|
+
|
|
64
|
+
- You need the [GitHub CLI](https://cli.github.com) (`gh`) and a remote called `upstream`. Add one with `git remote add upstream <url>`. Both remotes must be GitHub repos.
|
|
65
|
+
- The pull request goes into the default branch of `upstream`. Its title is your last commit message.
|
|
66
|
+
- If a pull request from that branch is already open, the push updates it and `acp` doesn't open a second one. `-ua` merges the open one.
|
|
67
|
+
- For the merge, `acp` checks two `gh` accounts for write access: the one named like the owner of `upstream` (if you're logged in to it), then the one that opened the pull request. It merges with the first that has it.
|
|
68
|
+
- If the merge fails, the pull request stays open and `acp` prints its link.
|
|
69
|
+
|
|
70
|
+
## Multiple GitHub accounts
|
|
71
|
+
|
|
72
|
+
If you have the [GitHub CLI](https://cli.github.com) (`gh`) installed, `acp` picks the right account for each repo automatically:
|
|
73
|
+
|
|
74
|
+
| Remote | Account used |
|
|
75
|
+
| --- | --- |
|
|
76
|
+
| `https://github.com/SENODROOM/acp-push` | `SENODROOM` |
|
|
77
|
+
| `https://github.com/Gobibahu/some-repo` | `GobiBahu` (names are case-insensitive) |
|
|
78
|
+
| `https://github.com/some-org/project` (no matching account) | the account you used last |
|
|
79
|
+
|
|
80
|
+
Log in to each account once:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
gh auth login # log in as the first account
|
|
84
|
+
gh auth login # run again for the second account
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`acp` switches gh's active account to whichever one it used, so "last used" is always the most recent one. The token is only used for that one push and doesn't replace your saved git login. SSH remotes and non-GitHub remotes use your normal git login.
|
|
88
|
+
|
|
89
|
+
## git-multi-commit projects
|
|
90
|
+
|
|
91
|
+
If your repo root contains a `.git-multi-commit.json` file (created by [`git-multi-commit --config`](https://www.npmjs.com/package/git-multi-commit)), `acp` still runs `git add .` and `git commit` locally, but then runs `git-multi-commit` instead of `git push`:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
git add .
|
|
95
|
+
git commit -m "<one of 25 random messages>"
|
|
96
|
+
git-multi-commit
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
No `origin` remote is needed in this case. With `-u` / `-ua`, `acp` checks for the `origin` and `upstream` remotes: if both exist, it also pushes the branch to `origin` and opens (and with `-ua`, merges) the pull request after `git-multi-commit` finishes. If either is missing, it prints a warning and skips that part. `-b` only applies when the pull request step runs. Install it with `npm install -g git-multi-commit`.
|
|
100
|
+
|
|
101
|
+
## Notes
|
|
102
|
+
|
|
103
|
+
- If there is nothing new to commit, `acp` skips the commit and still pushes, so any commits you made earlier get sent.
|
|
104
|
+
- `-b <name>` pushes your current local branch to `<name>` on the remote, creating it there if it doesn't exist yet.
|
|
105
|
+
|
|
106
|
+
## Custom messages
|
|
107
|
+
|
|
108
|
+
Edit the list in `lib/messages.js`.
|
|
109
|
+
|
|
110
|
+
## License
|
|
111
|
+
|
|
112
|
+
MIT
|