@coder11125/omg 0.3.0 → 0.3.3
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 +170 -81
- package/dist/index.js +262 -210
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
# Oh My Git (`omg`)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[simple-git](https://github.com/steveukx/git-js),
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
> *Because git is powerful... and power corrupts absolutely.*
|
|
4
|
+
|
|
5
|
+
`omg` is a friendly CLI wrapper that translates git's cryptic error messages into human speak. Built with [commander](https://github.com/tj/commander.js), [simple-git](https://github.com/steveukx/git-js), [chalk](https://github.com/chalk/chalk), and [ora](https://github.com/sindresorhus/ora).
|
|
6
|
+
|
|
7
|
+
## Why omg?
|
|
8
|
+
|
|
9
|
+
Let's be honest: git is a time machine with a interface designed by someone who hates you.
|
|
10
|
+
|
|
11
|
+
- `fatal: not possible to fast-forward, aborting` → *What?!*
|
|
12
|
+
- `error: Your local changes would be overwritten by merge` → *But I just wanted to...*
|
|
13
|
+
- `CONFLICT (content): Merge conflict in src/index.js` → *Why does this always happen on Friday?!*
|
|
14
|
+
|
|
15
|
+
`omg` wraps all that angst into simple, friendly commands. It won't make git less confusing, but at least you'll have a friendlier error message to laugh at while you cry.
|
|
8
16
|
|
|
9
17
|
## Install
|
|
10
18
|
|
|
@@ -20,34 +28,40 @@ That exposes the `omg` binary on your `PATH`.
|
|
|
20
28
|
|
|
21
29
|
### Commit
|
|
22
30
|
|
|
23
|
-
Stage all changes and commit in one step:
|
|
31
|
+
Stage all changes and commit in one step. Git makes this two commands because... reasons:
|
|
24
32
|
|
|
25
33
|
```bash
|
|
26
34
|
omg -c "message"
|
|
27
35
|
```
|
|
28
36
|
|
|
37
|
+
> 💡 Pro tip: If you forget the `-m` flag with regular git, you get thrown into Vim. `omg` won't do that to you. You're welcome.
|
|
38
|
+
|
|
29
39
|
### Checkout
|
|
30
40
|
|
|
31
|
-
Switch to an existing branch:
|
|
41
|
+
Switch to an existing branch. Regular git uses `git checkout` which also restores files, detaches HEADs, and probably makes toast if you ask nicely. `omg` just switches branches:
|
|
32
42
|
|
|
33
43
|
```bash
|
|
34
|
-
omg
|
|
44
|
+
omg --visit <branch>
|
|
35
45
|
```
|
|
36
46
|
|
|
37
47
|
### Status
|
|
38
48
|
|
|
39
|
-
Show a friendly summary of the current repository state:
|
|
49
|
+
Show a friendly summary of the current repository state. Unlike `git status`, which looks like a novel by Stephen King:
|
|
40
50
|
|
|
41
51
|
```bash
|
|
42
52
|
omg status
|
|
43
53
|
```
|
|
44
54
|
|
|
55
|
+
> No more reading 47 lines to figure out if you're on main or master. We just tell you.
|
|
56
|
+
|
|
45
57
|
### Branch management
|
|
46
58
|
|
|
59
|
+
Git branches are like multiverse theory: cool in concept, terrifying when you have 47 of them and no idea where you are.
|
|
60
|
+
|
|
47
61
|
```bash
|
|
48
62
|
omg branch # list all local branches (* marks current)
|
|
49
63
|
omg branch -n <name> # create a new branch (stay on current)
|
|
50
|
-
omg branch -n <name> -s
|
|
64
|
+
omg branch -n <name> -s # create and switch to it
|
|
51
65
|
omg branch -d <name> # delete a branch (must be fully merged)
|
|
52
66
|
```
|
|
53
67
|
|
|
@@ -61,70 +75,94 @@ omg remote <url> <name> # add a new remote with a custom name
|
|
|
61
75
|
|
|
62
76
|
### Push
|
|
63
77
|
|
|
78
|
+
Share your code with the world (or your team, or just your future self wondering what you were thinking).
|
|
79
|
+
|
|
64
80
|
```bash
|
|
65
81
|
omg push # push to upstream
|
|
66
82
|
omg push <remote> # push to specific remote
|
|
67
83
|
omg push -f # force push with lease (safer)
|
|
68
84
|
```
|
|
69
85
|
|
|
86
|
+
> ⚠️ `-f` is `--force-with-lease`, not nuclear `--force`. We're trying to prevent "git push origin main --force" horror stories.
|
|
87
|
+
|
|
70
88
|
### Pull
|
|
71
89
|
|
|
90
|
+
Download changes from remote. The `-r` flag uses rebase, which keeps history linear because merge commits are like littering in your git log:
|
|
91
|
+
|
|
72
92
|
```bash
|
|
73
93
|
omg pull # pull from upstream
|
|
74
94
|
omg pull <remote> # pull from specific remote
|
|
75
|
-
omg pull -r # pull with rebase
|
|
95
|
+
omg pull -r # pull with rebase (cleaner history)
|
|
76
96
|
```
|
|
77
97
|
|
|
78
98
|
### Merge
|
|
79
99
|
|
|
100
|
+
Combine branches. Squash merging is like stuffing all your messy commits into one neat package so nobody knows how many times you "fixed the fix":
|
|
101
|
+
|
|
80
102
|
```bash
|
|
81
103
|
omg merge <branch> # merge branch into current
|
|
82
|
-
omg merge <branch> --squash # squash merge
|
|
83
|
-
omg merge --abort # abort ongoing merge
|
|
104
|
+
omg merge <branch> --squash # squash merge (hide the evidence)
|
|
105
|
+
omg merge --abort # abort ongoing merge (panic button)
|
|
84
106
|
```
|
|
85
107
|
|
|
86
108
|
### Rebase
|
|
87
109
|
|
|
110
|
+
Rebasing: for when you want to rewrite history like a politician. "I definitely wrote this feature in one perfect commit."
|
|
111
|
+
|
|
88
112
|
```bash
|
|
89
113
|
omg rebase <branch> # rebase current onto branch
|
|
90
114
|
omg rebase --continue # continue after resolving conflicts
|
|
91
|
-
omg rebase --abort # abort rebase
|
|
115
|
+
omg rebase --abort # abort rebase (we've all been there)
|
|
92
116
|
```
|
|
93
117
|
|
|
94
118
|
### Stash
|
|
95
119
|
|
|
120
|
+
Stash: git's "hide your mess in the closet" feature. Your stashes will eventually become a time capsule of code you forgot existed.
|
|
121
|
+
|
|
96
122
|
```bash
|
|
97
|
-
omg stash # stash current changes
|
|
98
|
-
omg stash pop # pop most recent stash
|
|
99
|
-
omg stash list # list all stashes
|
|
100
|
-
omg stash drop 0 # drop stash at index 0
|
|
101
|
-
omg stash apply 0 # apply stash
|
|
123
|
+
omg stash # stash current changes (sweep under rug)
|
|
124
|
+
omg stash pop # pop most recent stash (hope you remember what's in there)
|
|
125
|
+
omg stash list # list all stashes (your abandoned children)
|
|
126
|
+
omg stash drop 0 # drop stash at index 0 (let go of the past)
|
|
127
|
+
omg stash apply 0 # apply stash but keep it ( commitment issues)
|
|
102
128
|
```
|
|
103
129
|
|
|
104
130
|
### Log
|
|
105
131
|
|
|
106
|
-
View commit history with pretty formatting:
|
|
132
|
+
View commit history with pretty formatting. Finally, a log you can actually read without your eyes bleeding:
|
|
107
133
|
|
|
108
134
|
```bash
|
|
109
135
|
omg log # show last 10 commits
|
|
110
|
-
omg log -n 20 # show last 20 commits
|
|
111
|
-
omg log --oneline # condensed
|
|
112
|
-
omg log -n 5 --oneline #
|
|
136
|
+
omg log -n 20 # show last 20 commits (journey into the past)
|
|
137
|
+
omg log --oneline # condensed format (for the lazy)
|
|
138
|
+
omg log -n 5 --oneline # last 5, one-line (just the highlights)
|
|
113
139
|
```
|
|
114
140
|
|
|
115
141
|
### Diff
|
|
116
142
|
|
|
117
|
-
Review changes before committing:
|
|
143
|
+
Review changes before committing. Because "I don't know what I changed" is not a valid excuse at standup:
|
|
118
144
|
|
|
119
145
|
```bash
|
|
120
|
-
omg diff # show unstaged changes
|
|
121
|
-
omg diff --staged # show staged changes
|
|
146
|
+
omg diff # show unstaged changes (the "oops" detector)
|
|
147
|
+
omg diff --staged # show staged changes (what you're about to regret)
|
|
122
148
|
omg diff src/index.ts # show changes for specific file
|
|
123
149
|
```
|
|
124
150
|
|
|
151
|
+
### Blame
|
|
152
|
+
|
|
153
|
+
Find out who broke that line of code. Perfect for passive-aggressive code reviews:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
omg blame <file> # show line-by-line authorship
|
|
157
|
+
omg blame <file> -L 42 # show blame for specific line only
|
|
158
|
+
omg blame <file> --stats # show author statistics with heatmap
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
> 💡 Pro tip: Use `--stats` to see who really owns the file. Spoiler: it's probably you from 3 years ago wondering "what was I thinking?"
|
|
162
|
+
|
|
125
163
|
### Clone
|
|
126
164
|
|
|
127
|
-
|
|
165
|
+
Make a local copy of someone else's beautiful disaster:
|
|
128
166
|
|
|
129
167
|
```bash
|
|
130
168
|
omg clone <url> # clone to default directory
|
|
@@ -133,56 +171,58 @@ omg clone <url> my-project # clone to custom directory
|
|
|
133
171
|
|
|
134
172
|
### Ship
|
|
135
173
|
|
|
136
|
-
|
|
174
|
+
🚢 **It. Just. Works.**
|
|
175
|
+
|
|
176
|
+
One command to rule them all: stage → commit → fetch → rebase → push. For when you're tired of typing the same 5 commands in a row.
|
|
137
177
|
|
|
138
178
|
```bash
|
|
139
179
|
omg ship "fix: handle null pointer" # commit and ship
|
|
140
|
-
omg ship # just sync and push
|
|
141
|
-
omg ship -n # dry run -
|
|
180
|
+
omg ship # just sync and push (trust the process)
|
|
181
|
+
omg ship -n # dry run - see what would happen
|
|
142
182
|
omg ship --no-rebase # use merge instead of rebase
|
|
143
183
|
```
|
|
144
184
|
|
|
145
185
|
Ship automatically:
|
|
146
|
-
- Stages uncommitted changes
|
|
147
|
-
- Commits with your message (if
|
|
148
|
-
- Fetches from remote
|
|
149
|
-
- Rebases if you're behind (
|
|
150
|
-
- Pushes to origin
|
|
151
|
-
- Shows PR URL hint for GitHub remotes
|
|
186
|
+
- Stages uncommitted changes (even that console.log you forgot)
|
|
187
|
+
- Commits with your message (or judges you if you don't provide one)
|
|
188
|
+
- Fetches from remote (so you know if someone broke main)
|
|
189
|
+
- Rebases if you're behind (because merge bubbles are gross)
|
|
190
|
+
- Pushes to origin (send it!)
|
|
191
|
+
- Shows PR URL hint for GitHub remotes (you're welcome)
|
|
152
192
|
|
|
153
193
|
### Oops
|
|
154
194
|
|
|
155
|
-
|
|
195
|
+
We all make mistakes. Git makes recovering from them feel like solving a Rubik's cube blindfolded. `omg oops` is your "undo" button for life:
|
|
156
196
|
|
|
157
197
|
```bash
|
|
158
|
-
omg oops # show recovery menu
|
|
159
|
-
omg oops uncommit # undo last commit, keep changes
|
|
160
|
-
omg oops discard # undo last commit, discard changes
|
|
161
|
-
omg oops unstage # unstage all staged files
|
|
162
|
-
omg oops unadd src/index.ts # unstage specific file
|
|
163
|
-
omg oops restore-branch #
|
|
198
|
+
omg oops # show recovery menu (the panic room)
|
|
199
|
+
omg oops uncommit # undo last commit, keep changes (take-backsies)
|
|
200
|
+
omg oops discard # undo last commit, discard changes (nuclear option)
|
|
201
|
+
omg oops unstage # unstage all staged files (stage fright)
|
|
202
|
+
omg oops unadd src/index.ts # unstage specific file (partial regret)
|
|
203
|
+
omg oops restore-branch # recover deleted branches (Lazarus mode)
|
|
164
204
|
```
|
|
165
205
|
|
|
166
206
|
### Sync
|
|
167
207
|
|
|
168
|
-
|
|
208
|
+
The "I just want to get back to main, pull, and go back to my branch without typing 47 commands" command:
|
|
169
209
|
|
|
170
210
|
```bash
|
|
171
|
-
omg sync # sync with main (stash → checkout
|
|
211
|
+
omg sync # sync with main (full journey: stash → checkout → pull → prune → return → pop)
|
|
172
212
|
omg sync -b develop # sync with a different base branch
|
|
173
213
|
```
|
|
174
214
|
|
|
175
|
-
Sync
|
|
176
|
-
- Stashes
|
|
177
|
-
- Switches to main (
|
|
178
|
-
- Pulls latest
|
|
179
|
-
- Prunes
|
|
180
|
-
- Returns to your feature branch
|
|
181
|
-
- Restores your stashed
|
|
215
|
+
Sync does the hokey pokey:
|
|
216
|
+
- Stashes your mess (so it's safe)
|
|
217
|
+
- Switches to main (the promised land)
|
|
218
|
+
- Pulls latest (catch up on gossip)
|
|
219
|
+
- Prunes dead branches (spring cleaning)
|
|
220
|
+
- Returns to your feature branch (back to reality)
|
|
221
|
+
- Restores your stashed mess (welcome home)
|
|
182
222
|
|
|
183
223
|
### Doctor
|
|
184
224
|
|
|
185
|
-
|
|
225
|
+
Git checkups: because prevention is better than "why is my repo on fire?!"
|
|
186
226
|
|
|
187
227
|
```bash
|
|
188
228
|
omg doctor # run health checks
|
|
@@ -190,41 +230,42 @@ omg doctor --fix # auto-fix issues where safe
|
|
|
190
230
|
```
|
|
191
231
|
|
|
192
232
|
Doctor checks for:
|
|
193
|
-
- Uncommitted changes
|
|
194
|
-
- Staged but uncommitted files
|
|
195
|
-
- Branch behind/ahead status
|
|
196
|
-
- No remote configured
|
|
197
|
-
- Merge/rebase in progress
|
|
198
|
-
- Detached HEAD state
|
|
199
|
-
- Binary files in commits
|
|
200
|
-
- Accumulating stashes
|
|
233
|
+
- Uncommitted changes (your "I'll finish this later" pile)
|
|
234
|
+
- Staged but uncommitted files (the forgotten middle child)
|
|
235
|
+
- Branch behind/ahead status (are you lost?)
|
|
236
|
+
- No remote configured (coding into the void)
|
|
237
|
+
- Merge/rebase in progress (unfinished business)
|
|
238
|
+
- Detached HEAD state (you've gone full zombie)
|
|
239
|
+
- Binary files in commits (why is your .zip file 100MB?)
|
|
240
|
+
- Accumulating stashes (digital hoarding is still hoarding)
|
|
201
241
|
|
|
202
242
|
### Combine flags
|
|
203
243
|
|
|
204
244
|
Flags can be combined in a single invocation, e.g. commit then switch:
|
|
205
245
|
|
|
206
246
|
```bash
|
|
207
|
-
omg -c "wip: refactor"
|
|
247
|
+
omg -c "wip: refactor" --visit feature/new-thing
|
|
208
248
|
```
|
|
209
249
|
|
|
210
250
|
### Other
|
|
211
251
|
|
|
212
252
|
```bash
|
|
213
|
-
omg --help
|
|
214
|
-
omg --version
|
|
253
|
+
omg --help # show help
|
|
254
|
+
omg --version # show version (also -V)
|
|
255
|
+
omg --verbose # show detailed error output (show nerd errors)
|
|
215
256
|
```
|
|
216
257
|
|
|
217
258
|
### Update
|
|
218
259
|
|
|
219
|
-
|
|
260
|
+
Self-improvement for your CLI:
|
|
220
261
|
|
|
221
262
|
```bash
|
|
222
|
-
omg update # check for updates
|
|
263
|
+
omg update # check for updates (be better than yesterday)
|
|
223
264
|
```
|
|
224
265
|
|
|
225
266
|
### Init
|
|
226
267
|
|
|
227
|
-
|
|
268
|
+
Start a new git repository. The first step on a long journey of merge conflicts:
|
|
228
269
|
|
|
229
270
|
```bash
|
|
230
271
|
omg init # initialize in current directory
|
|
@@ -234,48 +275,50 @@ omg init -m "Initial commit" # initialize with first commit
|
|
|
234
275
|
|
|
235
276
|
### Tag
|
|
236
277
|
|
|
237
|
-
|
|
278
|
+
Mark important moments in history. Like "v1.0.0" (aka "it barely works but marketing wants a release"):
|
|
238
279
|
|
|
239
280
|
```bash
|
|
240
|
-
omg tag # list all tags
|
|
281
|
+
omg tag # list all tags (milestones)
|
|
241
282
|
omg tag v1.0.0 # create lightweight tag
|
|
242
|
-
omg tag v1.0.0 -m "Release" # create annotated tag
|
|
283
|
+
omg tag v1.0.0 -m "Release" # create annotated tag (fancy!)
|
|
243
284
|
```
|
|
244
285
|
|
|
245
286
|
### Fetch
|
|
246
287
|
|
|
247
|
-
|
|
288
|
+
Check what your coworkers broke while you were sleeping:
|
|
248
289
|
|
|
249
290
|
```bash
|
|
250
|
-
omg fetch # fetch from all remotes
|
|
291
|
+
omg fetch # fetch from all remotes (the gossip gatherer)
|
|
251
292
|
omg fetch origin # fetch from specific remote
|
|
252
293
|
```
|
|
253
294
|
|
|
254
295
|
### Reset
|
|
255
296
|
|
|
256
|
-
|
|
297
|
+
Time travel with varying degrees of danger:
|
|
257
298
|
|
|
258
299
|
```bash
|
|
259
|
-
omg reset # unstage files (
|
|
260
|
-
omg reset --soft # keep changes staged
|
|
261
|
-
omg reset --hard # discard all changes (
|
|
300
|
+
omg reset # unstage files (the "oops" fix)
|
|
301
|
+
omg reset --soft # keep changes staged (gentle)
|
|
302
|
+
omg reset --hard # discard all changes (point of no return ⚠️)
|
|
262
303
|
```
|
|
263
304
|
|
|
305
|
+
> ⚠️ `--hard` is called that for a reason. There's no undo button for this one.
|
|
306
|
+
|
|
264
307
|
### Revert
|
|
265
308
|
|
|
266
|
-
|
|
309
|
+
Undo a commit the *right* way (by making a new commit that undoes it). Unlike `reset`, this won't get you fired:
|
|
267
310
|
|
|
268
311
|
```bash
|
|
269
|
-
omg revert <commit> # revert a commit (
|
|
312
|
+
omg revert <commit> # revert a commit (professional take-backsies)
|
|
270
313
|
omg revert --continue # continue after resolving conflicts
|
|
271
314
|
```
|
|
272
315
|
|
|
273
316
|
### Cherry-pick
|
|
274
317
|
|
|
275
|
-
|
|
318
|
+
Steal a commit from another branch. It's not really stealing if it's version control:
|
|
276
319
|
|
|
277
320
|
```bash
|
|
278
|
-
omg cherry-pick <commit> # apply commit from another branch
|
|
321
|
+
omg cherry-pick <commit> # apply commit from another branch (borrowed code)
|
|
279
322
|
omg cherry-pick --continue # continue after resolving conflicts
|
|
280
323
|
```
|
|
281
324
|
|
|
@@ -288,6 +331,42 @@ omg config user.name # get current value
|
|
|
288
331
|
omg config user.name "John" # set value
|
|
289
332
|
```
|
|
290
333
|
|
|
334
|
+
### Verbose Mode (For the Curious)
|
|
335
|
+
|
|
336
|
+
By default, `omg` speaks human. When git throws a tantrum, we translate:
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
$ omg push
|
|
340
|
+
✖ Push failed
|
|
341
|
+
(OMG) 🤓 Nerd Error hidden: Run omg push -u origin main to solve it
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
But maybe you're a purist and want to see the raw git error. We support that too:
|
|
345
|
+
|
|
346
|
+
```bash
|
|
347
|
+
$ omg push --verbose
|
|
348
|
+
✖ Push failed
|
|
349
|
+
(OMG) 🤓 Nerd Error hidden: Run omg push -u origin main to solve it
|
|
350
|
+
|
|
351
|
+
Details:
|
|
352
|
+
fatal: The current branch main has no upstream branch.
|
|
353
|
+
To push the current branch and set the remote as upstream, use
|
|
354
|
+
git push --set-upstream origin main
|
|
355
|
+
|
|
356
|
+
To have this happen automatically for branches without a tracking
|
|
357
|
+
upstream, see 'push.autoSetupRemote' in 'git help config'.
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
Use `--verbose` when you want to see git's full essay:
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
omg status --verbose # show detailed error output
|
|
364
|
+
omg push --verbose # show full git error messages
|
|
365
|
+
omg --verbose -c "message" # combine with other commands
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
> 🤓 Fun fact: Git error messages were originally written to fit on punch cards. That's why they're so... concise.
|
|
369
|
+
|
|
291
370
|
## Development
|
|
292
371
|
|
|
293
372
|
```bash
|
|
@@ -298,4 +377,14 @@ npm run typecheck # type-check without emitting
|
|
|
298
377
|
# try the CLI locally without publishing
|
|
299
378
|
npm link
|
|
300
379
|
omg --help
|
|
301
|
-
```
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
## Philosophy
|
|
385
|
+
|
|
386
|
+
> "Git is a tool that lets you confidently delete code on Monday, regret it on Tuesday, and find it again on Wednesday. `omg` just makes the emotional rollercoaster more bearable."
|
|
387
|
+
|
|
388
|
+
Remember: `omg` won't make you a better developer. But it might make you a happier one. And isn't that what really matters?
|
|
389
|
+
|
|
390
|
+
**Pro tip:** If you ever feel overwhelmed by git, just remember: Linus Torvalds created git in 2005 because existing tools weren't painful enough. You're not the problem. Git is the problem. `omg` is the aspirin.
|