acp-push 1.0.0 → 1.0.2

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 +4 -2
  2. package/bin/acp.js +3 -9
  3. package/package.json +2 -14
package/README.md CHANGED
@@ -11,9 +11,11 @@ runs:
11
11
  ```bash
12
12
  git add .
13
13
  git commit -m "<one of 25 random messages>"
14
- git push origin main
14
+ git push origin HEAD:main
15
15
  ```
16
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
+
17
19
  ## Install
18
20
 
19
21
  ```bash
@@ -44,7 +46,7 @@ acp -m "Fix login bug" # custom message
44
46
  ## Notes
45
47
 
46
48
  - If there is nothing new to commit, `acp` skips the commit and still pushes, so any commits you made earlier get sent.
47
- - If you're on a different branch than the one you're pushing, `acp` warns you, since your new commit lives on your current branch.
49
+ - `-b <name>` pushes your current local branch to `<name>` on the remote, creating it there if it doesn't exist yet.
48
50
  - `-u` needs a remote called `upstream`. Add one with `git remote add upstream <url>`.
49
51
 
50
52
  ## Custom messages
package/bin/acp.js CHANGED
@@ -133,14 +133,6 @@ function main() {
133
133
  fail(`Remote "${remote}" does not exist. Add it with: git remote add ${remote} <url>`);
134
134
  }
135
135
 
136
- const current = git(['rev-parse', '--abbrev-ref', 'HEAD'], true).stdout.trim();
137
- if (current && current !== 'HEAD' && current !== branch) {
138
- console.log(
139
- yellow(`⚠ You are on "${current}" but pushing "${branch}". ` +
140
- `Your new commit stays on "${current}" — use "acp -b ${current}" to push it.`)
141
- );
142
- }
143
-
144
136
  step(['add', '.']);
145
137
 
146
138
  // "git diff --cached --quiet" exits 0 when nothing is staged.
@@ -150,7 +142,9 @@ function main() {
150
142
  step(['commit', '-m', message || randomMessage()]);
151
143
  }
152
144
 
153
- step(['push', remote, branch]);
145
+ // "HEAD:<branch>" pushes whatever branch you're on (main, master, anything)
146
+ // to <branch> on the remote, so the default always lands on "main".
147
+ step(['push', remote, `HEAD:${branch}`]);
154
148
  console.log(green(`✔ Pushed to ${remote}/${branch}`));
155
149
  }
156
150
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "acp-push",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "git add, commit (with a random message) and push in one command: acp",
5
5
  "bin": {
6
6
  "acp": "bin/acp.js"
@@ -20,17 +20,5 @@
20
20
  "engines": {
21
21
  "node": ">=14"
22
22
  },
23
- "license": "MIT",
24
- "main": "index.js",
25
- "directories": {
26
- "lib": "lib"
27
- },
28
- "scripts": {
29
- "test": "echo \"Error: no test specified\" && exit 1"
30
- },
31
- "repository": {
32
- "type": "git",
33
- "url": "https://SENODROOM/acp-push.git"
34
- },
35
- "author": "Muhammad Saad Amin"
23
+ "license": "MIT"
36
24
  }