acp-push 1.4.2 → 2.1.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.
Files changed (3) hide show
  1. package/README.md +126 -112
  2. package/bin/acp.js +641 -552
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,112 +1,126 @@
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, and `-u` / `-ua` / `-b` are ignored. 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
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-allow` (or `--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
+ ### No `origin`, only `upstream`
71
+
72
+ If the repo has an `upstream` remote but no `origin`, `acp -u` / `acp -ua` push a branch straight to `upstream`, open a pull request from it into `upstream`'s default branch, and (with `-ua`) merge it:
73
+
74
+ ```bash
75
+ git push upstream HEAD:<branch>
76
+ gh pr create --repo <upstream owner>/<repo> --head <upstream owner>:<branch>
77
+ gh pr merge <pr> --merge
78
+ ```
79
+
80
+ - `<branch>` is `-b <name>` if you gave one, otherwise the branch you are on. On `upstream`'s default branch (a pull request can't go from a branch into itself) `acp` creates a new `acp-<date>` branch instead.
81
+ - Of your logged-in `gh` accounts, `acp` uses one that can push to `upstream` (the owner's account first) for the push, the pull request and the merge.
82
+ - The branch is not deleted after the merge.
83
+
84
+ ## Multiple GitHub accounts
85
+
86
+ If you have the [GitHub CLI](https://cli.github.com) (`gh`) installed, `acp` picks the right account for each repo automatically:
87
+
88
+ | Remote | Account used |
89
+ | --- | --- |
90
+ | `https://github.com/SENODROOM/acp-push` | `SENODROOM` |
91
+ | `https://github.com/Gobibahu/some-repo` | `GobiBahu` (names are case-insensitive) |
92
+ | `https://github.com/some-org/project` (no matching account) | the account you used last |
93
+
94
+ Log in to each account once:
95
+
96
+ ```bash
97
+ gh auth login # log in as the first account
98
+ gh auth login # run again for the second account
99
+ ```
100
+
101
+ `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.
102
+
103
+ ## git-multi-commit projects
104
+
105
+ 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`:
106
+
107
+ ```bash
108
+ git add .
109
+ git commit -m "<one of 25 random messages>"
110
+ git-multi-commit
111
+ ```
112
+
113
+ No `origin` remote is needed in this case. With `-u` / `-ua`, `acp` looks for an `upstream` remote: if it exists, it also pushes the branch (to `origin`, or straight to `upstream` when there is no `origin`) and opens (and with `-ua`, merges) the pull request after `git-multi-commit` finishes. If `upstream` 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`.
114
+
115
+ ## Notes
116
+
117
+ - If there is nothing new to commit, `acp` skips the commit and still pushes, so any commits you made earlier get sent.
118
+ - `-b <name>` pushes your current local branch to `<name>` on the remote, creating it there if it doesn't exist yet.
119
+
120
+ ## Custom messages
121
+
122
+ Edit the list in `lib/messages.js`.
123
+
124
+ ## License
125
+
126
+ MIT