sugarjar 2.0.0.beta.1 → 2.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +181 -0
- data/CONTRIBUTING.md +37 -0
- data/README.md +148 -193
- data/bin/sj +62 -9
- data/examples/sample_config.yaml +24 -0
- data/examples/sample_repoconfig.yaml +77 -0
- data/lib/sugarjar/commands/amend.rb +17 -0
- data/lib/sugarjar/commands/bclean.rb +233 -0
- data/lib/sugarjar/commands/branch.rb +42 -0
- data/lib/sugarjar/commands/checks.rb +141 -0
- data/lib/sugarjar/commands/debuginfo.rb +16 -0
- data/lib/sugarjar/commands/feature.rb +35 -0
- data/lib/sugarjar/commands/pullsuggestions.rb +35 -0
- data/lib/sugarjar/commands/push.rb +55 -0
- data/lib/sugarjar/commands/smartclone.rb +30 -0
- data/lib/sugarjar/commands/smartpullrequest.rb +102 -0
- data/lib/sugarjar/commands/up.rb +124 -0
- data/lib/sugarjar/commands.rb +335 -5
- data/lib/sugarjar/repoconfig.rb +2 -4
- data/lib/sugarjar/util.rb +20 -309
- data/lib/sugarjar/version.rb +1 -1
- data/sugarjar.gemspec +11 -5
- metadata +26 -7
data/README.md
CHANGED
|
@@ -18,29 +18,31 @@ If you miss Mondrian or Phabricator - this is the tool for you!
|
|
|
18
18
|
|
|
19
19
|
If you don't, there's a ton of useful stuff for everyone!
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
[
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
##
|
|
21
|
+
Jump to what you're most interested in:
|
|
22
|
+
|
|
23
|
+
* [Common Use-cases](#common-use-cases)
|
|
24
|
+
* [Auto Cleanup Squash-merged branches](#auto-cleanup-squash-merged-branches)
|
|
25
|
+
* [Smarter clones and remotes](#smarter-clones-and-remotes)
|
|
26
|
+
* [Work with stacked branches more easily](#work-with-stacked-branches-more-easily)
|
|
27
|
+
* [Creating Stacked PRs with subfeatures](#creating-stacked-prs-with-subfeatures)
|
|
28
|
+
* [Have a better lint/unittest experience!](#have-a-better-lintunittest-experience)
|
|
29
|
+
* [Better push defaults](#better-push-defaults)
|
|
30
|
+
* [Cleaning up your own history](#cleaning-up-your-own-history)
|
|
31
|
+
* [Better feature branches](#better-feature-branches)
|
|
32
|
+
* [Smartlog](#smartlog)
|
|
33
|
+
* [Sync work across workstations](#sync-work-across-workstations)
|
|
34
|
+
* [Pulling in suggestions from the web](#pulling-in-suggestions-from-the-web)
|
|
35
|
+
* [And more!](#and-more)
|
|
36
|
+
* [Installation](#installation)
|
|
37
|
+
* [Configuration](#configuration)
|
|
38
|
+
* [Repository Configuration](#repository-configuration)
|
|
39
|
+
* [Commit Templates](#commit-templates)
|
|
40
|
+
* [Enterprise GitHub](#enterprise-github)
|
|
41
|
+
* [FAQ](#faq)
|
|
42
|
+
|
|
43
|
+
## Common Use-cases
|
|
44
|
+
|
|
45
|
+
### Auto cleanup squash-merged branches
|
|
44
46
|
|
|
45
47
|
It is common for a PR to go back and forth with a variety of nits, lint fixes,
|
|
46
48
|
typos, etc. that can muddy history. So many projects will "squash and merge"
|
|
@@ -49,12 +51,12 @@ doesn't work. Git will tell you the branch isn't fully merged. You can, of
|
|
|
49
51
|
course `git branch -D <branch>`, but that does no safety checks at all, it
|
|
50
52
|
forces the deletion.
|
|
51
53
|
|
|
52
|
-
Enter `sj
|
|
53
|
-
and safely deletes if so.
|
|
54
|
+
Enter `sj lbclean` - it determines if the contents of your branch has been merge
|
|
55
|
+
and safely deletes if so. (Note: `lbclean` stands for "local branch clean", and
|
|
56
|
+
is aliased to `bclean` for both backwards-compatibility and also since it's the
|
|
57
|
+
most common branch-cleanup command).
|
|
54
58
|
|
|
55
|
-
|
|
56
|
-
sj bclean
|
|
57
|
-
```
|
|
59
|
+

|
|
58
60
|
|
|
59
61
|
Will delete a branch, if it has been merged, **even if it was squash-merged**.
|
|
60
62
|
|
|
@@ -64,44 +66,43 @@ You can pass it a branch if you'd like (it defaults to the branch you're on):
|
|
|
64
66
|
But it gets better! You can use `sj bcleanall` to remove all branches that have
|
|
65
67
|
been merged:
|
|
66
68
|
|
|
67
|
-
|
|
68
|
-
$ git branch
|
|
69
|
-
* argparse
|
|
70
|
-
master
|
|
71
|
-
feature
|
|
72
|
-
hubhost
|
|
73
|
-
$ git bcleanall
|
|
74
|
-
Skipping branch argparse - there are unmerged commits
|
|
75
|
-
Reaped branch feature
|
|
76
|
-
Reaped branch hubhost
|
|
77
|
-
```
|
|
69
|
+

|
|
78
70
|
|
|
79
|
-
|
|
71
|
+
There is also `sj rbclean` ("remote branch clean") (and `sj rbcleanall`) for
|
|
72
|
+
cleanup of remote branches. *Note*: This cannot differentiate between
|
|
73
|
+
PR/feature branches which have been merged and long-lived release branches that
|
|
74
|
+
have been merged (e.g. if '2.0-release' is a branch and has no commits not in
|
|
75
|
+
main, it will be deleted).
|
|
76
|
+
|
|
77
|
+
There is even `sj gbclean` ("global branch clean") (and `sj gbcleanall`) which will
|
|
78
|
+
do both the local and remote cleaning.
|
|
79
|
+
|
|
80
|
+
*NOTE*: Remote branch cleaning is still experimental, use with caution!
|
|
81
|
+
|
|
82
|
+
### Smarter clones and remotes
|
|
80
83
|
|
|
81
84
|
There's a pattern to every new repo we want to contribute to. First we fork,
|
|
82
85
|
then we clone the fork, then we add a remote of the upstream repo. It's
|
|
83
86
|
monotonous. SugarJar does this for you:
|
|
84
87
|
|
|
85
|
-
|
|
86
|
-
sj smartclone jaymzh/sugarjar
|
|
87
|
-
```
|
|
88
|
+

|
|
88
89
|
|
|
89
|
-
|
|
90
|
+
`sj` accepts both `smartclone` and `sclone` for this command.
|
|
90
91
|
|
|
91
92
|
This will:
|
|
92
93
|
|
|
93
|
-
*
|
|
94
|
+
* Fork the repo to your personal org (if you don't already have a fork)
|
|
94
95
|
* Clone your fork
|
|
95
96
|
* Add the original as an 'upstream' remote
|
|
96
97
|
|
|
97
98
|
Note that it takes short names for repos. No need to specify a full URL,
|
|
98
99
|
just a $org/$repo.
|
|
99
100
|
|
|
100
|
-
Like `git clone`, `sj
|
|
101
|
+
Like `git clone`, `sj smartclone` will accept an additional argument as the
|
|
101
102
|
destination directory to clone to. It will also pass any other unknown options
|
|
102
103
|
to `git clone` under the hood.
|
|
103
104
|
|
|
104
|
-
|
|
105
|
+
### Work with stacked branches more easily
|
|
105
106
|
|
|
106
107
|
It's important to break changes into reviewable chunks, but working with
|
|
107
108
|
stacked branches can be confusing. SugarJar provides several tools to make this
|
|
@@ -111,122 +112,75 @@ First, and foremost, is `feature` and `subfeature`. Regardless of stacking, the
|
|
|
111
112
|
way to create a new feature bracnh with sugarjar is with `sj feature` (or `sj
|
|
112
113
|
f` for short):
|
|
113
114
|
|
|
114
|
-
|
|
115
|
-
$ sj feature mynewthing
|
|
116
|
-
Created feature branch mynewthing based on origin/main
|
|
117
|
-
```
|
|
115
|
+

|
|
118
116
|
|
|
119
|
-
A "feature" in SugarJar
|
|
120
|
-
from "
|
|
121
|
-
which remote is the "upstream", even if it's
|
|
122
|
-
the primary branch (
|
|
117
|
+
A "feature" in SugarJar parlance just means that the branch is always created
|
|
118
|
+
from "most main" - this is usually `upstream/main`, but SJ will figure out
|
|
119
|
+
which remote is the "upstream", even if it's `origin`, and then will determine
|
|
120
|
+
the primary branch (`main` or for older repos `master`). It's also smart enough
|
|
123
121
|
to fetch that remote first to make sure you're working on the latest HEAD.
|
|
124
122
|
|
|
125
|
-
When you want to create a stacked PR, you can create
|
|
123
|
+
When you want to create a stacked PR, you can create `subfeature`, which, at
|
|
126
124
|
its core is just a branch created from the current branch:
|
|
127
125
|
|
|
128
|
-
|
|
129
|
-
$ sj subfeature dependentnewthing
|
|
130
|
-
Created feature branch dependentnewthing based on mynewthing
|
|
131
|
-
```
|
|
126
|
+

|
|
132
127
|
|
|
133
128
|
If you create branches like this then sugarjar can now make several things
|
|
134
129
|
much easier:
|
|
135
130
|
|
|
136
131
|
* `sj up` will rebase intelligently
|
|
137
132
|
* After an `sj bclean` of a branch earlier in the tree, `sj up` will update
|
|
138
|
-
the tracked branch to "
|
|
133
|
+
the tracked branch to "most main"
|
|
139
134
|
|
|
140
135
|
There are two commands that will show you the state of your stacked branches:
|
|
141
136
|
|
|
142
137
|
* `sj binfo` - shows the current branch and its ancestors up to your primary branch
|
|
143
|
-
* `sj
|
|
138
|
+
* `sj smartlog` (aka `sj sl`) - shows you the whole tree.
|
|
144
139
|
|
|
145
|
-
To continue with the example above, my `
|
|
140
|
+
To continue with the example above, my `smartlog` might look like:
|
|
146
141
|
|
|
147
|
-
|
|
148
|
-
$ sj sl
|
|
149
|
-
* 59c0522 (HEAD -> dependentnewthing) anothertest
|
|
150
|
-
* 6ebaa28 (mynewthing) test
|
|
151
|
-
o 7a0ffd0 (tag: v1.1.2, origin/main, origin/HEAD, main) Version bump (#160)
|
|
152
|
-
```
|
|
142
|
+

|
|
153
143
|
|
|
154
|
-
|
|
144
|
+
As you can see, `mynewthing` is derived from `main`, and `dependentnewthing` is
|
|
145
|
+
derived from `mynewthing`.
|
|
155
146
|
|
|
156
|
-
|
|
157
|
-
$ sj feature anotherfeature
|
|
158
|
-
Created feature branch anotherfeature based on origin/main
|
|
159
|
-
# do stuff
|
|
160
|
-
$ sj subfeature dependent2
|
|
161
|
-
Created feature branch dependent2 based on anotherfeature
|
|
162
|
-
# do stuff
|
|
163
|
-
```
|
|
147
|
+
Now lets make a different feature stack:
|
|
164
148
|
|
|
165
|
-
|
|
149
|
+

|
|
166
150
|
|
|
167
|
-
|
|
168
|
-
$ sj sl
|
|
169
|
-
* af6f143 (HEAD -> dependent2) morestuff
|
|
170
|
-
* 028c7f4 (anotherfeature) stuff
|
|
171
|
-
| * 59c0522 (dependentnewthing) anothertest
|
|
172
|
-
| * 6ebaa28 (mynewthing) test
|
|
173
|
-
|/
|
|
174
|
-
o 7a0ffd0 (tag: v1.1.2, origin/main, origin/HEAD, main) Version bump (#160)
|
|
175
|
-
```
|
|
151
|
+
The `smartlog` will now show us this tree, and it's a bit more interesting:
|
|
176
152
|
|
|
177
|
-
|
|
153
|
+

|
|
178
154
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
[mynewthing d33e082] change
|
|
187
|
-
1 file changed, 1 insertion(+)
|
|
188
|
-
$ sj sl
|
|
189
|
-
* d33e082 (HEAD -> mynewthing) change
|
|
190
|
-
| * af6f143 (dependent2) morestuff
|
|
191
|
-
| * 028c7f4 (anotherfeature) stuff
|
|
192
|
-
| | * 59c0522 (dependentnewthing) anothertest
|
|
193
|
-
| |/
|
|
194
|
-
|/|
|
|
195
|
-
* | 6ebaa28 test
|
|
196
|
-
|/
|
|
197
|
-
o 7a0ffd0 (tag: v1.1.2, origin/main, origin/HEAD, main) Version bump (#160)
|
|
198
|
-
```
|
|
155
|
+
Here we can see from `main`, we have two branches: one going to `mynewthing`
|
|
156
|
+
and one going to `anotherfeature`. Each of those has their own dependent branch
|
|
157
|
+
on top.
|
|
158
|
+
|
|
159
|
+
Now, what happens if I make a change to `mynewthing` (the bottom of the first stack)?
|
|
160
|
+
|
|
161
|
+

|
|
199
162
|
|
|
200
163
|
We can see here now that `dependentnewthing`, is based off a commit that _used_
|
|
201
|
-
to be `mynewthing
|
|
202
|
-
|
|
164
|
+
to be `mynewthing` (`5086ee`), but `mynewthing` has moved. Both `mynewthing`
|
|
165
|
+
and `dependentnewthing` are derived from `5086ee` (the old `mynewthing`), but
|
|
166
|
+
`dependentnewthing` isn't (yet) based on the current `mynewthing`. But SugarJar
|
|
167
|
+
will handle this all correctly when we ask it to update the branch:
|
|
203
168
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
dependentnewthing rebased on mynewthing
|
|
212
|
-
$ sj sl
|
|
213
|
-
* 93ed585 (HEAD -> dependentnewthing) anothertest
|
|
214
|
-
* d33e082 (mynewthing) change
|
|
215
|
-
* 6ebaa28 test
|
|
216
|
-
| * af6f143 (dependent2) morestuff
|
|
217
|
-
| * 028c7f4 (anotherfeature) stuff
|
|
218
|
-
|/
|
|
219
|
-
o 7a0ffd0 (tag: v1.1.2, origin/main, origin/HEAD, main) Version bump (#160)
|
|
220
|
-
```
|
|
169
|
+

|
|
170
|
+
|
|
171
|
+
Here we see that SugarJar knew that `dependentnewthing` should be rebased onto
|
|
172
|
+
`mynewthing`, and it did the right thing - from main there's still the
|
|
173
|
+
`50806ee` _and_ the new additional change which are now both part of the
|
|
174
|
+
`mynewthing` branch, and `dependentnewthing` is based on that branch, this
|
|
175
|
+
including all 3 commits in the right order.
|
|
221
176
|
|
|
222
177
|
Now, lets say that `mynewthing` gets merged and we use `bclean` to clean it all
|
|
223
178
|
up, what happens then?
|
|
224
179
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
```
|
|
180
|
+

|
|
181
|
+
|
|
182
|
+
SugarJar detects that branch is gone and thus this branch should now be based
|
|
183
|
+
on the upstream main branch!
|
|
230
184
|
|
|
231
185
|
### Creating Stacked PRs with subfeatures
|
|
232
186
|
|
|
@@ -242,12 +196,12 @@ It looks like this is a subfeature, would you like to base this PR on mynewthing
|
|
|
242
196
|
...
|
|
243
197
|
```
|
|
244
198
|
|
|
245
|
-
|
|
199
|
+
### Have a better lint/unittest experience!
|
|
246
200
|
|
|
247
201
|
Ever made a PR, only to find out later that it failed tests because of some
|
|
248
202
|
small lint issue? Not anymore! SJ can be configured to run things before
|
|
249
203
|
pushing. For example,in the SugarJar repo, we have it run Rubocop (ruby lint)
|
|
250
|
-
and Markdownlint
|
|
204
|
+
and Markdownlint `on_push`. If those fail, it lets you know and doesn't push.
|
|
251
205
|
|
|
252
206
|
You can configure SugarJar to tell it how to run both lints and unittests for
|
|
253
207
|
a given repo and if one or both should be run prior to pushing.
|
|
@@ -255,31 +209,31 @@ a given repo and if one or both should be run prior to pushing.
|
|
|
255
209
|
The details on the config file format is below, but we provide three commands:
|
|
256
210
|
|
|
257
211
|
```shell
|
|
258
|
-
|
|
212
|
+
sj lint
|
|
259
213
|
```
|
|
260
214
|
|
|
261
215
|
Run all linters.
|
|
262
216
|
|
|
263
217
|
```shell
|
|
264
|
-
|
|
218
|
+
sj unit
|
|
265
219
|
```
|
|
266
220
|
|
|
267
221
|
Run all unittests.
|
|
268
222
|
|
|
269
223
|
```shell
|
|
270
|
-
|
|
224
|
+
sj smartpush # or spush
|
|
271
225
|
```
|
|
272
226
|
|
|
273
227
|
Run configured push-time actions (nothing, lint, unit, both), and do not
|
|
274
228
|
push if any of them fail.
|
|
275
229
|
|
|
276
|
-
|
|
230
|
+
### Better push defaults
|
|
277
231
|
|
|
278
232
|
In addition to running pre-push tests for you `smartpush` also picks smart
|
|
279
233
|
defaults for push. So if you `sj spush` with no arguments, it uses the
|
|
280
234
|
`origin` remote and the same branch name you're on as the remote branch.
|
|
281
235
|
|
|
282
|
-
|
|
236
|
+
### Cleaning up your own history
|
|
283
237
|
|
|
284
238
|
Perhaps you contribute to a project that prefers to use merge commits, so you
|
|
285
239
|
like to clean up your own history. This is often difficult to get right - a
|
|
@@ -299,7 +253,7 @@ command is a mouthful! Enter `sj fpush`. It has all the smarts of `sj
|
|
|
299
253
|
smartpush` (runs configured pre-push actions), but adds `--force-with-lease` to
|
|
300
254
|
the command!
|
|
301
255
|
|
|
302
|
-
|
|
256
|
+
### Better feature branches
|
|
303
257
|
|
|
304
258
|
When you want to start a new feature, you want to start developing against
|
|
305
259
|
latest. That's why `sj feature` defaults to creating a branch against what we
|
|
@@ -328,14 +282,29 @@ use branch-based workflows and branches need to be prefixed with e.g. `$USER/`.
|
|
|
328
282
|
For example, if your prefix was `user/`, then `sj feature foo` would create
|
|
329
283
|
`user/foo`, and `sj co foo` would switch to `user/foo`.
|
|
330
284
|
|
|
331
|
-
|
|
285
|
+
### Smartlog
|
|
332
286
|
|
|
333
287
|
Smartlog will show you a tree diagram of your branches! Simply run `sj
|
|
334
288
|
smartlog` or `sj sl` for short.
|
|
335
289
|
|
|
336
|
-

|
|
290
|
+

|
|
291
|
+
|
|
292
|
+
### Sync work across workstations
|
|
337
293
|
|
|
338
|
-
|
|
294
|
+
If you work on multiple workstations, keeping your branches in-sync can be a
|
|
295
|
+
pain. SugarJar provides `sync` to help with this.
|
|
296
|
+
|
|
297
|
+
For example, if you do some work on feature `foo` on machine1 and push to
|
|
298
|
+
`origin/foo` (intending to eventually merge to `upstream/main`), then on
|
|
299
|
+
machine2, you pull that branch, do more work, which you also push to
|
|
300
|
+
`origin/foo`, then on machine1, you can do `sj sync` to pull down the changes
|
|
301
|
+
from `origin/foo`. If you have local changes, that are not already on
|
|
302
|
+
`origin/foo`, those will be rebased on top of the changes from `origin/foo`.
|
|
303
|
+
|
|
304
|
+
It's very similar to `sj up`, but instead of rebasing on top of the tracking
|
|
305
|
+
branch, it rebases on top of the push target branch.
|
|
306
|
+
|
|
307
|
+
### Pulling in suggestions from the web
|
|
339
308
|
|
|
340
309
|
When someone 'suggests' a change in the GitHub WebUI, once you choose to commit
|
|
341
310
|
them, your origin and local branches are no longer in-sync. The
|
|
@@ -344,23 +313,42 @@ local branch. This command will show a diff and ask for confirmation before
|
|
|
344
313
|
attempting the merge and - if allowed to continue - will use a fast-forward
|
|
345
314
|
merge.
|
|
346
315
|
|
|
347
|
-
|
|
316
|
+
### And more!
|
|
348
317
|
|
|
349
318
|
See `sj help` for more commands!
|
|
350
319
|
|
|
320
|
+
## Installation
|
|
321
|
+
|
|
322
|
+
Sugarjar is packaged in a variety of Linux distributions - see if it's on the
|
|
323
|
+
list here, and if so, use your package manager (or `gem`) to install it:
|
|
324
|
+
|
|
325
|
+
[](https://repology.org/project/sugarjar/versions)
|
|
326
|
+
|
|
327
|
+
If you are using a Linux distribution version that is end-of-life'd, click the
|
|
328
|
+
above image, it'll take you to a page that lists unsupported distro versions
|
|
329
|
+
as well (they'll have older SugarJar, but they'll probably still have some
|
|
330
|
+
version).
|
|
331
|
+
|
|
332
|
+
Ubuntu users, Ubuntu versions prior to 24.x cannot be updated, so if you're on
|
|
333
|
+
an older Ubuntu please use [this
|
|
334
|
+
PPA](https://launchpad.net/~michel-slm/+archive/ubuntu/sugarjar) from our
|
|
335
|
+
Ubuntu package maintainer.
|
|
336
|
+
|
|
337
|
+
For MacOS users, we recommend using Homebrew - SugarJar is now in Homebrew Core.
|
|
338
|
+
|
|
339
|
+
Finally, if none of those work for you, you can clone this repo and run it
|
|
340
|
+
directly from there.
|
|
341
|
+
|
|
351
342
|
## Configuration
|
|
352
343
|
|
|
353
344
|
Sugarjar will read in both a system-level config file
|
|
354
345
|
(`/etc/sugarjar/config.yaml`) and a user-level config file
|
|
355
|
-
`~/.config/sugarjar/config.yaml
|
|
346
|
+
(`~/.config/sugarjar/config.yaml`), if they exist. Anything in the user config
|
|
356
347
|
will override the system config, and command-line options override both. The
|
|
357
|
-
yaml file is a straight key-value pair of options without their '--'.
|
|
358
|
-
example:
|
|
348
|
+
yaml file is a straight key-value pair of options without their '--'.
|
|
359
349
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
github_user: jaymzh
|
|
363
|
-
```
|
|
350
|
+
See [examples/sample_config.yaml](examples/sample_config.yaml) for an example
|
|
351
|
+
configuration file.
|
|
364
352
|
|
|
365
353
|
In addition, the environment variable `SUGARJAR_LOGLEVEL` can be defined to set
|
|
366
354
|
a log level. This is primarily used as a way to turn debug on earlier in order to
|
|
@@ -378,43 +366,10 @@ ignore_deprecated_options:
|
|
|
378
366
|
## Repository Configuration
|
|
379
367
|
|
|
380
368
|
Sugarjar looks for a `.sugarjar.yaml` in the root of the repository to tell it
|
|
381
|
-
how to handle repo-specific things.
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
* `lint_list_cmd` - A command to run which will print out linters to run, one
|
|
386
|
-
per line. Takes precedence over `lint`. The command (and the resulting
|
|
387
|
-
linters) will be run from the root of the repo.
|
|
388
|
-
* `unit` - A list of scripts to run on `sj unit`. These should be unittest
|
|
389
|
-
runners like rspec or pyunit. Test will be run from the root of the repo.
|
|
390
|
-
* `unit_list_cmd` - A command to run which will print out the unit tests to
|
|
391
|
-
run, one more line. Takes precedence over `unit`. The command (and the
|
|
392
|
-
resulting unit tests) will be run from the root of the repo.
|
|
393
|
-
* `on_push` - A list of types (`lint`, `unit`) of checks to run before pushing.
|
|
394
|
-
It is highly recommended this is only `lint`. The goal here is to allow for
|
|
395
|
-
the user to get quick stylistic feedback before pushing their branch to avoid
|
|
396
|
-
the push-fix-push-fix loop.
|
|
397
|
-
* `commit_template` - A path to a commit template to set in the `commit.template`
|
|
398
|
-
git config for this repo. Should be either a fully-qualified path, or a path
|
|
399
|
-
relative to the repo root.
|
|
400
|
-
* `include_from` - This will read an additional repoconfig file and merge it
|
|
401
|
-
into the one being read. The value should be relative to the root of the
|
|
402
|
-
repo. This will not error if the file does not exist, it is intended for
|
|
403
|
-
organizations to allow users to optionally extend a default repo config.
|
|
404
|
-
* `overwrite_from` - Same as `include_from`, but completely overwrites the
|
|
405
|
-
base configuration if the file is found.
|
|
406
|
-
|
|
407
|
-
Example configuration:
|
|
408
|
-
|
|
409
|
-
```yaml
|
|
410
|
-
lint:
|
|
411
|
-
- scripts/lint
|
|
412
|
-
unit:
|
|
413
|
-
- scripts/unit
|
|
414
|
-
on_push:
|
|
415
|
-
- lint
|
|
416
|
-
commit_template: .commit-template.txt
|
|
417
|
-
```
|
|
369
|
+
how to handle repo-specific things. See
|
|
370
|
+
[examples/sample_repoconfig.yaml](examples/sample_repoconfig.yaml) for an
|
|
371
|
+
example configuration that walks through all valid repo configurations in
|
|
372
|
+
detail.
|
|
418
373
|
|
|
419
374
|
### Commit Templates
|
|
420
375
|
|
|
@@ -471,9 +426,9 @@ it on Windows, but I'll happily accept patches for Windows compatibility.
|
|
|
471
426
|
|
|
472
427
|
**How do I get tab-completion?**
|
|
473
428
|
|
|
474
|
-
If the package for your OS/distro didn't set it up
|
|
475
|
-
that `sugarjar_completion.bash` is included in the package, and you can
|
|
476
|
-
source that in your dotfiles, assuming you are using bash.
|
|
429
|
+
If the package for your OS/distro didn't set it up automatically, you should
|
|
430
|
+
find that `sugarjar_completion.bash` is included in the package, and you can
|
|
431
|
+
simply source that in your dotfiles, assuming you are using bash.
|
|
477
432
|
|
|
478
433
|
**What happens now that Sapling is released?**
|
|
479
434
|
|
|
@@ -485,4 +440,4 @@ Sapling is a great tool and solves a variety of problems SugarJar will never be
|
|
|
485
440
|
able to. However, it is a significant workflow change, that won't be
|
|
486
441
|
appropriate for all users or use-cases. Similarly there are workflows and tools
|
|
487
442
|
that Sapling breaks. So worry not, SugarJar will continue to be maintained and
|
|
488
|
-
developed
|
|
443
|
+
developed.
|
data/bin/sj
CHANGED
|
@@ -118,15 +118,6 @@ COMMANDS:
|
|
|
118
118
|
Same as "amend" but without changing the message. Alias for
|
|
119
119
|
"git commit --amend --no-edit".
|
|
120
120
|
|
|
121
|
-
bclean [<branch>]
|
|
122
|
-
If safe, delete the current branch (or the specified branch).
|
|
123
|
-
Unlike "git branch -d", bclean can handle squash-merged branches.
|
|
124
|
-
Think of it as a smarter "git branch -d".
|
|
125
|
-
|
|
126
|
-
bcleanall
|
|
127
|
-
Walk all branches, and try to delete them if it's safe. See
|
|
128
|
-
"bclean" for details.
|
|
129
|
-
|
|
130
121
|
binfo
|
|
131
122
|
Verbose information about the current branch.
|
|
132
123
|
|
|
@@ -157,14 +148,62 @@ COMMANDS:
|
|
|
157
148
|
branches. Very convenient for keeping the branch behind a pull-
|
|
158
149
|
request clean.
|
|
159
150
|
|
|
151
|
+
globalbranchclean, gbclean [<branch>] [<remote>]
|
|
152
|
+
WARNING: EXPERIMENTAL COMMAND.
|
|
153
|
+
|
|
154
|
+
Combination of "lbclean" and "rbclean". Cleans up
|
|
155
|
+
both local and remote branches safely. See those commands for
|
|
156
|
+
details.
|
|
157
|
+
|
|
158
|
+
globalbranchcleanall, gbcleanall [<remote>]
|
|
159
|
+
WARNING: EXPERIMENTAL COMMAND.
|
|
160
|
+
|
|
161
|
+
Safely clean all branches, both local and remote. See "gbclean"
|
|
162
|
+
for details.
|
|
163
|
+
|
|
160
164
|
lint
|
|
161
165
|
Run any linters configured in .sugarjar.yaml.
|
|
162
166
|
|
|
167
|
+
localbranchclean, lbclean [<branch>]
|
|
168
|
+
If safe, delete the current branch (or the specified branch).
|
|
169
|
+
Unlike "git branch -d", lbclean can handle squash-merged branches.
|
|
170
|
+
Think of it as a smarter "git branch -d".
|
|
171
|
+
|
|
172
|
+
Aliased to 'bclean' for backwards compatibility.
|
|
173
|
+
|
|
174
|
+
localbranchcleanall, lbcleanall
|
|
175
|
+
Walk all branches, and try to delete them if it's safe. See
|
|
176
|
+
"lbclean" for details.
|
|
177
|
+
|
|
178
|
+
Aliased to 'bcleanall' for backwards compatibility.
|
|
179
|
+
|
|
163
180
|
pullsuggestions, ps
|
|
164
181
|
Pull any suggestions *that have been committed* in the GitHub UI.
|
|
165
182
|
This will show the diff and prompt for confirmation before
|
|
166
183
|
merging. Note that a fast-forward merge will be used.
|
|
167
184
|
|
|
185
|
+
remotebranchclean, rbclean [<branch>] [<remote>]
|
|
186
|
+
WARNING: EXPERIMENTAL COMMAND.
|
|
187
|
+
|
|
188
|
+
Similar to lbclean, except safely cleans up remote branches.
|
|
189
|
+
Unlike many git commands, <remote> comes after <branch> so
|
|
190
|
+
that you can specify a branch and the remote defaults to 'origin'.
|
|
191
|
+
This means you can do "sj rclean" to clean the remote branch with
|
|
192
|
+
the same name as the local one. Note that you probably want
|
|
193
|
+
"sclean", which will do both local and remote cleaning in one
|
|
194
|
+
command.
|
|
195
|
+
|
|
196
|
+
WARNING: This command cannot differentiate release branches
|
|
197
|
+
that are fully merged but still need to be kept around for future
|
|
198
|
+
work. So if main contains everything that 2.0-devel and 3.0-devel
|
|
199
|
+
has, then those branches will be deleted. Use with caution.
|
|
200
|
+
|
|
201
|
+
remotebranchcleanall, rbcleanall [<remote>]
|
|
202
|
+
WARNING: EXPERIMENTAL COMMAND.
|
|
203
|
+
|
|
204
|
+
Walk all remote branches, and try to delete them if it's safe. See
|
|
205
|
+
"rbclean" for details.
|
|
206
|
+
|
|
168
207
|
smartclone, sclone
|
|
169
208
|
A smart wrapper to "git clone" that handles forking and managing
|
|
170
209
|
remotes for you.
|
|
@@ -190,6 +229,20 @@ COMMANDS:
|
|
|
190
229
|
subfeature, sf <feature>
|
|
191
230
|
An alias for 'sj feature <feature> <current_branch>'
|
|
192
231
|
|
|
232
|
+
sync
|
|
233
|
+
Similar to `up`, except instead of rebasing on a tracked branch
|
|
234
|
+
(usually `upstream` remote), rebases to wherever our remote push
|
|
235
|
+
target is (usually `origin` remote). Useful for syncing work
|
|
236
|
+
across different machines.
|
|
237
|
+
|
|
238
|
+
For example, if you do some work on feature `foo` on machine1 and
|
|
239
|
+
push to `origin/foo` (intending to eventually merge to
|
|
240
|
+
`upstream/main`), then on machine2, you pull that branch, do more
|
|
241
|
+
work, which you also push to `origin/foo`, then on machine1, you
|
|
242
|
+
can do `sj sync` to pull down the changes from `origin/foo`. If
|
|
243
|
+
you have local changes, that are not already on `origin/foo`,
|
|
244
|
+
those will be rebased on top of the changes from `origin/foo`.
|
|
245
|
+
|
|
193
246
|
unit
|
|
194
247
|
Run any unitests configured in .sugarjar.yaml.
|
|
195
248
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# This is a sample SugarJar config
|
|
2
|
+
#
|
|
3
|
+
# SugarJar will look for this config in:
|
|
4
|
+
#
|
|
5
|
+
# - /etc/sugarjar/config.yaml
|
|
6
|
+
# - ~/.config/sugarjar/config.yaml
|
|
7
|
+
#
|
|
8
|
+
# The latter will overwrite anything in the former.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
# NOTE: This file does NOT document ALL options since any command-line option
|
|
12
|
+
# to SugarJar is a valid configuration in this file, so see `sj help` for full
|
|
13
|
+
# details.
|
|
14
|
+
|
|
15
|
+
# Autofill in my PRs from my commit message (default: true)
|
|
16
|
+
pr_autofile: true
|
|
17
|
+
|
|
18
|
+
# Auto stack PRs when subfeatures are detected (default is `nil`, which prompts,
|
|
19
|
+
# but use `true` or `false` to force an option without prompting)
|
|
20
|
+
pr_autostack: true
|
|
21
|
+
|
|
22
|
+
# Don't warn about deprecated config file options if they are in this
|
|
23
|
+
# list
|
|
24
|
+
ignore_deprecated_options: [ 'gh_cli' ]
|