-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathgit.ts
9812 lines (9742 loc) · 435 KB
/
git.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import { ai } from "@fig/autocomplete-generators";
const filterMessages = (out: string): string => {
return out.startsWith("warning:") || out.startsWith("error:")
? out.split("\n").slice(1).join("\n")
: out;
};
const postProcessTrackedFiles: Fig.Generator["postProcess"] = (
out,
context
) => {
const output = filterMessages(out);
if (output.startsWith("fatal:")) {
return [];
}
const files = output.split("\n").map((file) => {
const arr = file.trim().split(" ");
return { working: arr[0], file: arr.slice(1).join(" ").trim() };
});
return [
...files.map((item) => {
const file = item.file.replace(/^"|"$/g, "");
let ext = "";
try {
ext = file.split(".").slice(-1)[0];
} catch (e) {}
if (file.endsWith("/")) {
ext = "folder";
}
return {
name: file,
icon: `fig://icon?type=${ext}&color=ff0000&badge=${item.working}`,
description: "Changed tracked files",
// If the current file already is already added
// we want to lower the priority
priority: context.some((ctx) => ctx.includes(file)) ? 50 : 100,
};
}),
];
};
interface PostProcessBranchesOptions {
insertWithoutRemotes?: true;
}
const postProcessBranches =
(options: PostProcessBranchesOptions = {}): Fig.Generator["postProcess"] =>
(out) => {
const { insertWithoutRemotes = false } = options;
const output = filterMessages(out);
if (output.startsWith("fatal:")) {
return [];
}
const seen = new Set<string>();
return output
.split("\n")
.filter((line) => !line.trim().startsWith("HEAD"))
.map((branch) => {
let name = branch.trim();
const parts = branch.match(/\S+/g);
if (parts && parts.length > 1) {
if (parts[0] === "*") {
// We are in a detached HEAD state
if (branch.includes("HEAD detached")) {
return null;
}
// Current branch
return {
name: branch.replace("*", "").trim(),
description: "Current branch",
priority: 100,
icon: "⭐️",
};
} else if (parts[0] === "+") {
// Branch checked out in another worktree.
name = branch.replace("+", "").trim();
}
}
let description = "Branch";
if (insertWithoutRemotes && name.startsWith("remotes/")) {
name = name.slice(name.indexOf("/", 8) + 1);
description = "Remote branch";
}
const space = name.indexOf(" ");
if (space !== -1) {
name = name.slice(0, space);
}
return {
name,
description,
icon: "fig://icon?type=git",
priority: 75,
};
})
.filter((suggestion) => {
if (!suggestion) return false;
if (seen.has(suggestion.name)) return false;
seen.add(suggestion.name);
return true;
});
};
export const gitGenerators: Record<string, Fig.Generator> = {
// Commit history
commits: {
script: ["git", "--no-optional-locks", "log", "--oneline"],
postProcess: function (out) {
const output = filterMessages(out);
if (output.startsWith("fatal:")) {
return [];
}
return output.split("\n").map((line) => {
return {
name: line.substring(0, 7),
icon: "fig://icon?type=node",
description: line.substring(7),
};
});
},
},
// user aliases
aliases: {
script: ["git", "--no-optional-locks", "config", "--get-regexp", "^alias."],
cache: {
strategy: "stale-while-revalidate",
},
postProcess: (out) => {
const suggestions = out.split("\n").map((aliasLine) => {
const [name, ...parts] = aliasLine.slice("alias.".length).split(" ");
const value = parts.join(" ");
return {
name,
description: `Alias for '${value}'`,
icon: "fig://icon?type=commandkey",
};
});
const seen = new Set();
return suggestions.filter((suggestion) => {
if (seen.has(suggestion.name)) {
return false;
}
seen.add(suggestion.name);
return true;
});
},
},
revs: {
script: ["git", "rev-list", "--all", "--oneline"],
postProcess: function (out) {
const output = filterMessages(out);
if (output.startsWith("fatal:")) {
return [];
}
return output.split("\n").map((line) => {
return {
name: line.substring(0, 7),
icon: "fig://icon?type=node",
description: line.substring(7),
};
});
},
},
// Saved stashes
// TODO: maybe only print names of stashes
stashes: {
script: ["git", "--no-optional-locks", "stash", "list"],
postProcess: function (out) {
const output = filterMessages(out);
if (output.startsWith("fatal:")) {
return [];
}
return output.split("\n").map((file) => {
return {
// account for conventional commit messages
name: file.split(":").slice(2).join(":"),
insertValue: file.split(":")[0],
icon: `fig://icon?type=node`,
};
});
},
},
// Tree-ish
// This needs to be fleshed out properly....
// e.g. what is difference to commit-ish?
// Refer to this:https://stackoverflow.com/questions/23303549/what-are-commit-ish-and-tree-ish-in-git/40910185
// https://mirrors.edge.kernel.org/pub/software/scm/git/docs/#_identifier_terminology
treeish: {
script: ["git", "--no-optional-locks", "diff", "--cached", "--name-only"],
postProcess: function (out, tokens) {
const output = filterMessages(out);
if (output.startsWith("fatal:")) {
return [];
}
return output.split("\n").map((file) => {
return {
name: file,
insertValue: (!tokens.includes("--") ? "-- " : "") + file,
icon: `fig://icon?type=file`,
description: "Staged file",
};
});
},
},
// All branches
remoteLocalBranches: {
script: [
"git",
"--no-optional-locks",
"branch",
"-a",
"--no-color",
"--sort=-committerdate",
],
postProcess: postProcessBranches({ insertWithoutRemotes: true }),
},
localBranches: {
script: [
"git",
"--no-optional-locks",
"branch",
"--no-color",
"--sort=-committerdate",
],
postProcess: postProcessBranches({ insertWithoutRemotes: true }),
},
// custom generator to display local branches by default or
// remote branches if '-r' flag is used. See branch -d for use
localOrRemoteBranches: {
custom: async (tokens, executeShellCommand) => {
const pp = postProcessBranches({ insertWithoutRemotes: true });
if (tokens.includes("-r")) {
return pp?.(
(
await executeShellCommand({
command: "git",
args: [
"--no-optional-locks",
"-r",
"--no-color",
"--sort=-committerdate",
],
})
).stdout,
tokens
);
} else {
return pp?.(
(
await executeShellCommand({
command: "git",
args: [
"--no-optional-locks",
"branch",
"--no-color",
"--sort=-committerdate",
],
})
).stdout,
tokens
);
}
},
},
remotes: {
script: ["git", "--no-optional-locks", "remote", "-v"],
postProcess: function (out) {
const remoteURLs = out
.split("\n")
.reduce<Record<string, string>>((dict, line) => {
const pair = line.split("\t");
const remote = pair[0];
const url = pair[1].split(" ")[0];
dict[remote] = url;
return dict;
}, {});
return Object.keys(remoteURLs).map((remote) => {
const url = remoteURLs[remote];
let icon = "box";
if (url.includes("github.com")) {
icon = "github";
}
if (url.includes("gitlab.com")) {
icon = "gitlab";
}
if (url.includes("heroku.com")) {
icon = "heroku";
}
return {
name: remote,
icon: `fig://icon?type=${icon}`,
description: "Remote",
};
});
},
},
tags: {
script: [
"git",
"--no-optional-locks",
"tag",
"--list",
"--sort=-committerdate",
],
postProcess: function (output) {
return output.split("\n").map((tag) => ({
name: tag,
icon: "🏷️",
}));
},
},
// Files for staging
files_for_staging: {
script: ["git", "--no-optional-locks", "status", "--short"],
postProcess: (out, context) => {
// This whole function is a mess
const output = filterMessages(out);
if (output.startsWith("fatal:")) {
return [];
}
let files = output.split("\n").map((file) => {
// From "git --no-optional-locks status --short"
// M dev/github.ts // test file that was added
// M dev/kubectl.ts // test file that was not added
// A test2.txt // new added and tracked file
// ?? test.txt // new untracked file
const alreadyAdded = ["M", "A"].includes(file.charAt(0));
file = file.trim();
const arr = file.split(" ");
return {
working: arr[0],
file: arr.slice(1).join(" ").trim(),
alreadyAdded,
};
});
const paths = output.split("\n").map((file) => {
const arr = file
.slice(0, file.lastIndexOf("/") + 1)
.trim()
.split(" ");
return arr.slice(1).join(" ").trim();
});
const dirArr = [];
if (paths.length >= 2) {
let currentDir = paths[0];
let count = 1;
for (let i = 1; i < paths.length; i++) {
if (paths[i].includes(currentDir) && i + 1 !== paths.length) {
count++;
} else {
if (count >= 2) {
dirArr.push(currentDir);
}
count = 1;
}
currentDir = paths[i];
}
}
// Filter out the files that the user has already input in the current edit buffer
files = files.filter((item) => {
const file = item.file.replace(/^"|"$/g, "");
return !context.some((ctx) => {
return (
ctx === file ||
// Need to add support for proper globbing one day
(ctx.endsWith("*") && file.startsWith(ctx.slice(0, -1))) ||
(ctx.startsWith("*") && file.endsWith(ctx.slice(1)))
);
});
});
return [
...dirArr.map((name) => {
return {
name: name + "*",
description: "Wildcard",
icon: "fig://icon?type=asterisk",
};
}),
...files.map((item) => {
const file = item.file.replace(/^"|"$/g, "");
let ext = "";
try {
ext = file.split(".").slice(-1)[0];
} catch (e) {}
if (file.endsWith("/")) {
ext = "folder";
}
// If the current file is already added
// we want to lower the priority
const priority = item.alreadyAdded ? 50 : 100;
return {
name: file,
icon: `fig://icon?type=${ext}&color=ff0000&badge=${item.working}`,
description: "Changed file",
priority,
};
}),
];
},
},
getStagedFiles: {
script: [
"bash",
"-c",
"git --no-optional-locks status --short | sed -ne '/^M /p' -e '/A /p'",
],
postProcess: postProcessTrackedFiles,
},
getUnstagedFiles: {
script: ["git", "--no-optional-locks", "diff", "--name-only"],
splitOn: "\n",
},
getChangedTrackedFiles: {
script: function (context) {
if (context.includes("--staged") || context.includes("--cached")) {
return [
"bash",
"-c",
`git --no-optional-locks status --short | sed -ne '/^M /p' -e '/A /p'`,
];
} else {
return [
"bash",
"-c",
`git --no-optional-locks status --short | sed -ne '/M /p' -e '/A /p'`,
];
}
},
postProcess: postProcessTrackedFiles,
},
};
const configSuggestions: Fig.Suggestion[] = [
{
name: "add.ignore-errors",
description:
"Tells 'git add' to continue adding files when some files cannot be added due to indexing errors. Equivalent to the `--ignore-errors` option of git-add[1]. `add.ignore-errors` is deprecated, as it does not follow the usual naming convention for configuration variables",
deprecated: true,
hidden: true,
},
{
name: "add.interactive.useBuiltin",
description:
"Set to `false` to fall back to the original Perl implementation of the interactive version of git-add[1] instead of the built-in version. Is `true` by default",
},
{
name: "advice.addEmbeddedRepo",
description:
"Advice on what to do when you've accidentally added one git repo inside of another",
},
{
name: "advice.addEmptyPathspec",
description:
"Advice shown if a user runs the add command without providing the pathspec parameter",
},
{
name: "advice.addIgnoredFile",
description:
"Advice shown if a user attempts to add an ignored file to the index",
},
{
name: "advice.ambiguousFetchRefspec",
description:
"Advice shown when fetch refspec for multiple remotes map to the same remote-tracking branch namespace and causes branch tracking set-up to fail",
},
{
name: "advice.amWorkDir",
description:
"Advice that shows the location of the patch file when git-am[1] fails to apply it",
},
{
name: "advice.checkoutAmbiguousRemoteBranchName",
description:
"Advice shown when the argument to git-checkout[1] and git-switch[1] ambiguously resolves to a remote tracking branch on more than one remote in situations where an unambiguous argument would have otherwise caused a remote-tracking branch to be checked out. See the `checkout.defaultRemote` configuration variable for how to set a given remote to used by default in some situations where this advice would be printed",
},
{
name: "advice.commitBeforeMerge",
description:
"Advice shown when git-merge[1] refuses to merge to avoid overwriting local changes",
},
{
name: "advice.detachedHead",
description:
"Advice shown when you used git-switch[1] or git-checkout[1] to move to the detach HEAD state, to instruct how to create a local branch after the fact",
},
{
name: "advice.fetchShowForcedUpdates",
description:
"Advice shown when git-fetch[1] takes a long time to calculate forced updates after ref updates, or to warn that the check is disabled",
},
{
name: "advice.ignoredHook",
description:
"Advice shown if a hook is ignored because the hook is not set as executable",
},
{
name: "advice.implicitIdentity",
description:
"Advice on how to set your identity configuration when your information is guessed from the system username and domain name",
},
{
name: "advice.nestedTag",
description:
"Advice shown if a user attempts to recursively tag a tag object",
},
{
name: "advice.pushAlreadyExists",
description:
"Shown when git-push[1] rejects an update that does not qualify for fast-forwarding (e.g., a tag.)",
},
{
name: "advice.pushFetchFirst",
description:
"Shown when git-push[1] rejects an update that tries to overwrite a remote ref that points at an object we do not have",
},
{
name: "advice.pushNeedsForce",
description:
"Shown when git-push[1] rejects an update that tries to overwrite a remote ref that points at an object that is not a commit-ish, or make the remote ref point at an object that is not a commit-ish",
},
{
name: "advice.pushNonFFCurrent",
description:
"Advice shown when git-push[1] fails due to a non-fast-forward update to the current branch",
},
{
name: "advice.pushNonFFMatching",
description:
"Advice shown when you ran git-push[1] and pushed 'matching refs' explicitly (i.e. you used ':', or specified a refspec that isn't your current branch) and it resulted in a non-fast-forward error",
},
{
name: "advice.pushRefNeedsUpdate",
description:
"Shown when git-push[1] rejects a forced update of a branch when its remote-tracking ref has updates that we do not have locally",
},
{
name: "advice.pushUnqualifiedRefname",
description:
"Shown when git-push[1] gives up trying to guess based on the source and destination refs what remote ref namespace the source belongs in, but where we can still suggest that the user push to either refs/heads/* or refs/tags/* based on the type of the source object",
},
{
name: "advice.pushUpdateRejected",
description:
"Set this variable to 'false' if you want to disable 'pushNonFFCurrent', 'pushNonFFMatching', 'pushAlreadyExists', 'pushFetchFirst', 'pushNeedsForce', and 'pushRefNeedsUpdate' simultaneously",
},
{
name: "advice.resetNoRefresh",
description:
"Advice to consider using the `--no-refresh` option to git-reset[1] when the command takes more than 2 seconds to refresh the index after reset",
},
{
name: "advice.resolveConflict",
description:
"Advice shown by various commands when conflicts prevent the operation from being performed",
},
{
name: "advice.rmHints",
description:
"In case of failure in the output of git-rm[1], show directions on how to proceed from the current state",
},
{
name: "advice.sequencerInUse",
description: "Advice shown when a sequencer command is already in progress",
},
{
name: "advice.skippedCherryPicks",
description:
"Shown when git-rebase[1] skips a commit that has already been cherry-picked onto the upstream branch",
},
{
name: "advice.statusAheadBehind",
description:
"Shown when git-status[1] computes the ahead/behind counts for a local ref compared to its remote tracking ref, and that calculation takes longer than expected. Will not appear if `status.aheadBehind` is false or the option `--no-ahead-behind` is given",
},
{
name: "advice.statusHints",
description:
"Show directions on how to proceed from the current state in the output of git-status[1], in the template shown when writing commit messages in git-commit[1], and in the help message shown by git-switch[1] or git-checkout[1] when switching branch",
},
{
name: "advice.statusUoption",
description:
"Advise to consider using the `-u` option to git-status[1] when the command takes more than 2 seconds to enumerate untracked files",
},
{
name: "advice.submoduleAlternateErrorStrategyDie",
description:
'Advice shown when a submodule.alternateErrorStrategy option configured to "die" causes a fatal error',
},
{
name: "advice.submodulesNotUpdated",
description:
"Advice shown when a user runs a submodule command that fails because `git submodule update --init` was not run",
},
{
name: "advice.suggestDetachingHead",
description:
"Advice shown when git-switch[1] refuses to detach HEAD without the explicit `--detach` option",
},
{
name: "advice.updateSparsePath",
description:
"Advice shown when either git-add[1] or git-rm[1] is asked to update index entries outside the current sparse checkout",
},
{
name: "advice.waitingForEditor",
description:
"Print a message to the terminal whenever Git is waiting for editor input from the user",
},
{
name: "alias.*",
insertValue: "alias.{cursor}",
description:
"Command aliases for the git[1] command wrapper - e.g. after defining `alias.last = cat-file commit HEAD`, the invocation `git last` is equivalent to `git cat-file commit HEAD`. To avoid confusion and troubles with script usage, aliases that hide existing Git commands are ignored. Arguments are split by spaces, the usual shell quoting and escaping is supported. A quote pair or a backslash can be used to quote them",
},
{
name: "am.keepcr",
description:
"If true, git-am will call git-mailsplit for patches in mbox format with parameter `--keep-cr`. In this case git-mailsplit will not remove `\\r` from lines ending with `\\r\\n`. Can be overridden by giving `--no-keep-cr` from the command line. See git-am[1], git-mailsplit[1]",
},
{
name: "am.threeWay",
description:
"By default, `git am` will fail if the patch does not apply cleanly. When set to true, this setting tells `git am` to fall back on 3-way merge if the patch records the identity of blobs it is supposed to apply to and we have those blobs available locally (equivalent to giving the `--3way` option from the command line). Defaults to `false`. See git-am[1]",
},
{
name: "apply.ignoreWhitespace",
description:
"When set to 'change', tells 'git apply' to ignore changes in whitespace, in the same way as the `--ignore-space-change` option. When set to one of: no, none, never, false tells 'git apply' to respect all whitespace differences. See git-apply[1]",
},
{
name: "apply.whitespace",
description:
"Tells 'git apply' how to handle whitespaces, in the same way as the `--whitespace` option. See git-apply[1]",
},
{
name: "blame.blankBoundary",
description:
"Show blank commit object name for boundary commits in git-blame[1]. This option defaults to false",
},
{
name: "blame.coloring",
description:
"This determines the coloring scheme to be applied to blame output. It can be 'repeatedLines', 'highlightRecent', or 'none' which is the default",
},
{
name: "blame.date",
description:
"Specifies the format used to output dates in git-blame[1]. If unset the iso format is used. For supported values, see the discussion of the `--date` option at git-log[1]",
},
{
name: "blame.ignoreRevsFile",
description:
"Ignore revisions listed in the file, one unabbreviated object name per line, in git-blame[1]. Whitespace and comments beginning with `#` are ignored. This option may be repeated multiple times. Empty file names will reset the list of ignored revisions. This option will be handled before the command line option `--ignore-revs-file`",
},
{
name: "blame.markIgnoredLines",
description:
"Mark lines that were changed by an ignored revision that we attributed to another commit with a '?' in the output of git-blame[1]",
},
{
name: "blame.markUnblamableLines",
description:
"Mark lines that were changed by an ignored revision that we could not attribute to another commit with a '*' in the output of git-blame[1]",
},
{
name: "blame.showEmail",
description:
"Show the author email instead of author name in git-blame[1]. This option defaults to false",
},
{
name: "blame.showRoot",
description:
"Do not treat root commits as boundaries in git-blame[1]. This option defaults to false",
},
{
name: "branch.<name>.description",
insertValue: "branch.{cursor}.description",
description:
"Branch description, can be edited with `git branch --edit-description`. Branch description is automatically added in the format-patch cover letter or request-pull summary",
},
{
name: "branch.<name>.merge",
insertValue: "branch.{cursor}.merge",
description:
"Defines, together with branch.<name>.remote, the upstream branch for the given branch. It tells 'git fetch'/'git pull'/'git rebase' which branch to merge and can also affect 'git push' (see push.default). When in branch <name>, it tells 'git fetch' the default refspec to be marked for merging in FETCH_HEAD. The value is handled like the remote part of a refspec, and must match a ref which is fetched from the remote given by \"branch.<name>.remote\". The merge information is used by 'git pull' (which at first calls 'git fetch') to lookup the default branch for merging. Without this option, 'git pull' defaults to merge the first refspec fetched. Specify multiple values to get an octopus merge. If you wish to setup 'git pull' so that it merges into <name> from another branch in the local repository, you can point branch.<name>.merge to the desired branch, and use the relative path setting `.` (a period) for branch.<name>.remote",
},
{
name: "branch.<name>.mergeOptions",
insertValue: "branch.{cursor}.mergeOptions",
description:
"Sets default options for merging into branch <name>. The syntax and supported options are the same as those of git-merge[1], but option values containing whitespace characters are currently not supported",
},
{
name: "branch.<name>.pushRemote",
insertValue: "branch.{cursor}.pushRemote",
description:
"When on branch <name>, it overrides `branch.<name>.remote` for pushing. It also overrides `remote.pushDefault` for pushing from branch <name>. When you pull from one place (e.g. your upstream) and push to another place (e.g. your own publishing repository), you would want to set `remote.pushDefault` to specify the remote to push to for all branches, and use this option to override it for a specific branch",
},
{
name: "branch.<name>.rebase",
insertValue: "branch.{cursor}.rebase",
description:
'When true, rebase the branch <name> on top of the fetched branch, instead of merging the default branch from the default remote when "git pull" is run. See "pull.rebase" for doing this in a non branch-specific manner',
},
{
name: "branch.<name>.remote",
insertValue: "branch.{cursor}.remote",
description:
"When on branch <name>, it tells 'git fetch' and 'git push' which remote to fetch from/push to. The remote to push to may be overridden with `remote.pushDefault` (for all branches). The remote to push to, for the current branch, may be further overridden by `branch.<name>.pushRemote`. If no remote is configured, or if you are not on any branch and there is more than one remote defined in the repository, it defaults to `origin` for fetching and `remote.pushDefault` for pushing. Additionally, `.` (a period) is the current local repository (a dot-repository), see `branch.<name>.merge`'s final note below",
},
{
name: "branch.autoSetupMerge",
description:
"Tells 'git branch', 'git switch' and 'git checkout' to set up new branches so that git-pull[1] will appropriately merge from the starting point branch. Note that even if this option is not set, this behavior can be chosen per-branch using the `--track` and `--no-track` options. The valid settings are: `false` -- no automatic setup is done; `true` -- automatic setup is done when the starting point is a remote-tracking branch; `always` -- automatic setup is done when the starting point is either a local branch or remote-tracking branch; `inherit` -- if the starting point has a tracking configuration, it is copied to the new branch; `simple` -- automatic setup is done only when the starting point is a remote-tracking branch and the new branch has the same name as the remote branch. This option defaults to true",
},
{
name: "branch.autoSetupRebase",
description:
"When a new branch is created with 'git branch', 'git switch' or 'git checkout' that tracks another branch, this variable tells Git to set up pull to rebase instead of merge (see \"branch.<name>.rebase\"). When `never`, rebase is never automatically set to true. When `local`, rebase is set to true for tracked branches of other local branches. When `remote`, rebase is set to true for tracked branches of remote-tracking branches. When `always`, rebase will be set to true for all tracking branches. See \"branch.autoSetupMerge\" for details on how to set up a branch to track another branch. This option defaults to never",
},
{
name: "branch.sort",
description:
'This variable controls the sort ordering of branches when displayed by git-branch[1]. Without the "--sort=<value>" option provided, the value of this variable will be used as the default. See git-for-each-ref[1] field names for valid values',
},
{
name: "browser.<tool>.cmd",
insertValue: "browser.{cursor}.cmd",
description:
"Specify the command to invoke the specified browser. The specified command is evaluated in shell with the URLs passed as arguments. (See git-web{litdd}browse[1].)",
},
{
name: "browser.<tool>.path",
insertValue: "browser.{cursor}.path",
description:
"Override the path for the given tool that may be used to browse HTML help (see `-w` option in git-help[1]) or a working repository in gitweb (see git-instaweb[1])",
},
{
name: "checkout.defaultRemote",
description:
"When you run `git checkout <something>` or `git switch <something>` and only have one remote, it may implicitly fall back on checking out and tracking e.g. `origin/<something>`. This stops working as soon as you have more than one remote with a `<something>` reference. This setting allows for setting the name of a preferred remote that should always win when it comes to disambiguation. The typical use-case is to set this to `origin`",
},
{
name: "checkout.guess",
description:
"Provides the default value for the `--guess` or `--no-guess` option in `git checkout` and `git switch`. See git-switch[1] and git-checkout[1]",
},
{
name: "checkout.thresholdForParallelism",
description:
"When running parallel checkout with a small number of files, the cost of subprocess spawning and inter-process communication might outweigh the parallelization gains. This setting allows to define the minimum number of files for which parallel checkout should be attempted. The default is 100",
},
{
name: "checkout.workers",
description:
"The number of parallel workers to use when updating the working tree. The default is one, i.e. sequential execution. If set to a value less than one, Git will use as many workers as the number of logical cores available. This setting and `checkout.thresholdForParallelism` affect all commands that perform checkout. E.g. checkout, clone, reset, sparse-checkout, etc",
},
{
name: "clean.requireForce",
description:
"A boolean to make git-clean do nothing unless given -f, -i or -n. Defaults to true",
},
{
name: "clone.defaultRemoteName",
description:
"The name of the remote to create when cloning a repository. Defaults to `origin`, and can be overridden by passing the `--origin` command-line option to git-clone[1]",
},
{
name: "clone.filterSubmodules",
description:
"If a partial clone filter is provided (see `--filter` in git-rev-list[1]) and `--recurse-submodules` is used, also apply the filter to submodules",
},
{
name: "clone.rejectShallow",
description:
"Reject to clone a repository if it is a shallow one, can be overridden by passing option `--reject-shallow` in command line. See git-clone[1]",
},
{
name: "color.advice",
description:
"A boolean to enable/disable color in hints (e.g. when a push failed, see `advice.*` for a list). May be set to `always`, `false` (or `never`) or `auto` (or `true`), in which case colors are used only when the error output goes to a terminal. If unset, then the value of `color.ui` is used (`auto` by default)",
},
{
name: "color.advice.hint",
description: "Use customized color for hints",
},
{
name: "color.blame.highlightRecent",
description:
"Specify the line annotation color for `git blame --color-by-age` depending upon the age of the line",
},
{
name: "color.blame.repeatedLines",
description:
"Use the specified color to colorize line annotations for `git blame --color-lines`, if they come from the same commit as the preceding line. Defaults to cyan",
},
{
name: "color.branch",
description:
"A boolean to enable/disable color in the output of git-branch[1]. May be set to `always`, `false` (or `never`) or `auto` (or `true`), in which case colors are used only when the output is to a terminal. If unset, then the value of `color.ui` is used (`auto` by default)",
},
{
name: "color.branch.<slot>",
insertValue: "color.branch.{cursor}",
description:
"Use customized color for branch coloration. `<slot>` is one of `current` (the current branch), `local` (a local branch), `remote` (a remote-tracking branch in refs/remotes/), `upstream` (upstream tracking branch), `plain` (other refs)",
},
{
name: "color.decorate.<slot>",
insertValue: "color.decorate.{cursor}",
description:
"Use customized color for 'git log --decorate' output. `<slot>` is one of `branch`, `remoteBranch`, `tag`, `stash` or `HEAD` for local branches, remote-tracking branches, tags, stash and HEAD, respectively and `grafted` for grafted commits",
},
{
name: "color.diff",
description:
"Whether to use ANSI escape sequences to add color to patches. If this is set to `always`, git-diff[1], git-log[1], and git-show[1] will use color for all patches. If it is set to `true` or `auto`, those commands will only use color when output is to the terminal. If unset, then the value of `color.ui` is used (`auto` by default)",
},
{
name: "color.diff.<slot>",
insertValue: "color.diff.{cursor}",
description:
"Use customized color for diff colorization. `<slot>` specifies which part of the patch to use the specified color, and is one of `context` (context text - `plain` is a historical synonym), `meta` (metainformation), `frag` (hunk header), 'func' (function in hunk header), `old` (removed lines), `new` (added lines), `commit` (commit headers), `whitespace` (highlighting whitespace errors), `oldMoved` (deleted lines), `newMoved` (added lines), `oldMovedDimmed`, `oldMovedAlternative`, `oldMovedAlternativeDimmed`, `newMovedDimmed`, `newMovedAlternative` `newMovedAlternativeDimmed` (See the '<mode>' setting of '--color-moved' in git-diff[1] for details), `contextDimmed`, `oldDimmed`, `newDimmed`, `contextBold`, `oldBold`, and `newBold` (see git-range-diff[1] for details)",
},
{
name: "color.grep",
description:
"When set to `always`, always highlight matches. When `false` (or `never`), never. When set to `true` or `auto`, use color only when the output is written to the terminal. If unset, then the value of `color.ui` is used (`auto` by default)",
},
{
name: "color.grep.<slot>",
insertValue: "color.grep.{cursor}",
description:
"Use customized color for grep colorization. `<slot>` specifies which part of the line to use the specified color, and is one of",
},
{
name: "color.interactive",
description:
'When set to `always`, always use colors for interactive prompts and displays (such as those used by "git-add --interactive" and "git-clean --interactive"). When false (or `never`), never. When set to `true` or `auto`, use colors only when the output is to the terminal. If unset, then the value of `color.ui` is used (`auto` by default)',
},
{
name: "color.interactive.<slot>",
insertValue: "color.interactive.{cursor}",
description:
"Use customized color for 'git add --interactive' and 'git clean --interactive' output. `<slot>` may be `prompt`, `header`, `help` or `error`, for four distinct types of normal output from interactive commands",
},
{
name: "color.pager",
description:
"A boolean to specify whether `auto` color modes should colorize output going to the pager. Defaults to true; set this to false if your pager does not understand ANSI color codes",
},
{
name: "color.push",
description:
"A boolean to enable/disable color in push errors. May be set to `always`, `false` (or `never`) or `auto` (or `true`), in which case colors are used only when the error output goes to a terminal. If unset, then the value of `color.ui` is used (`auto` by default)",
},
{
name: "color.push.error",
description: "Use customized color for push errors",
},
{
name: "color.remote",
description:
'If set, keywords at the start of the line are highlighted. The keywords are "error", "warning", "hint" and "success", and are matched case-insensitively. May be set to `always`, `false` (or `never`) or `auto` (or `true`). If unset, then the value of `color.ui` is used (`auto` by default)',
},
{
name: "color.remote.<slot>",
insertValue: "color.remote.{cursor}",
description:
"Use customized color for each remote keyword. `<slot>` may be `hint`, `warning`, `success` or `error` which match the corresponding keyword",
},
{
name: "color.showBranch",
description:
"A boolean to enable/disable color in the output of git-show-branch[1]. May be set to `always`, `false` (or `never`) or `auto` (or `true`), in which case colors are used only when the output is to a terminal. If unset, then the value of `color.ui` is used (`auto` by default)",
},
{
name: "color.status",
description:
"A boolean to enable/disable color in the output of git-status[1]. May be set to `always`, `false` (or `never`) or `auto` (or `true`), in which case colors are used only when the output is to a terminal. If unset, then the value of `color.ui` is used (`auto` by default)",
},
{
name: "color.status.<slot>",
insertValue: "color.status.{cursor}",
description:
"Use customized color for status colorization. `<slot>` is one of `header` (the header text of the status message), `added` or `updated` (files which are added but not committed), `changed` (files which are changed but not added in the index), `untracked` (files which are not tracked by Git), `branch` (the current branch), `nobranch` (the color the 'no branch' warning is shown in, defaulting to red), `localBranch` or `remoteBranch` (the local and remote branch names, respectively, when branch and tracking information is displayed in the status short-format), or `unmerged` (files which have unmerged changes)",
},
{
name: "color.transport",
description:
"A boolean to enable/disable color when pushes are rejected. May be set to `always`, `false` (or `never`) or `auto` (or `true`), in which case colors are used only when the error output goes to a terminal. If unset, then the value of `color.ui` is used (`auto` by default)",
},
{
name: "color.transport.rejected",
description: "Use customized color when a push was rejected",
},
{
name: "color.ui",
description:
"This variable determines the default value for variables such as `color.diff` and `color.grep` that control the use of color per command family. Its scope will expand as more commands learn configuration to set a default for the `--color` option. Set it to `false` or `never` if you prefer Git commands not to use color unless enabled explicitly with some other configuration or the `--color` option. Set it to `always` if you want all output not intended for machine consumption to use color, to `true` or `auto` (this is the default since Git 1.8.4) if you want such output to use color when written to the terminal",
},
{
name: "column.branch",
description:
"Specify whether to output branch listing in `git branch` in columns. See `column.ui` for details",
},
{
name: "column.clean",
description:
"Specify the layout when list items in `git clean -i`, which always shows files and directories in columns. See `column.ui` for details",
},
{
name: "column.status",
description:
"Specify whether to output untracked files in `git status` in columns. See `column.ui` for details",
},
{
name: "column.tag",
description:
"Specify whether to output tag listing in `git tag` in columns. See `column.ui` for details",
},
{
name: "column.ui",
description:
"Specify whether supported commands should output in columns. This variable consists of a list of tokens separated by spaces or commas:",
},
{
name: "commit.cleanup",
description:
"This setting overrides the default of the `--cleanup` option in `git commit`. See git-commit[1] for details. Changing the default can be useful when you always want to keep lines that begin with comment character `#` in your log message, in which case you would do `git config commit.cleanup whitespace` (note that you will have to remove the help lines that begin with `#` in the commit log template yourself, if you do this)",
},
{
name: "commit.status",
description:
"A boolean to enable/disable inclusion of status information in the commit message template when using an editor to prepare the commit message. Defaults to true",
},
{
name: "commit.template",
description:
"Specify the pathname of a file to use as the template for new commit messages",
},
{
name: "commit.verbose",
description:
"A boolean or int to specify the level of verbose with `git commit`. See git-commit[1]",
},
{
name: "commitGraph.generationVersion",
description: