@@ -20,13 +20,13 @@ Table of contents:
20
20
posh-git is a PowerShell module that integrates Git and PowerShell by providing Git status summary information that
21
21
can be displayed in the PowerShell prompt, e.g.:
22
22
23
- ![ C:\Users\Keith\GitHub\posh-git [ master ≡ +0 ~ 1 -0 | +0 ~ 1 -0 !] > ] [ prompt-def-long ]
23
+ ![ C:\Users\Keith\GitHub\posh-git [ main ≡ +0 ~ 1 -0 | +0 ~ 1 -0 !] > ] [ prompt-def-long ]
24
24
25
25
posh-git also provides tab completion support for common git commands, branch names, paths and more.
26
26
For example, with posh-git, PowerShell can tab complete git commands like ` checkout ` by typing ` git ch ` and pressing
27
27
the <kbd >tab</kbd > key. That will tab complete to ` git checkout ` and if you keep pressing <kbd >tab</kbd >, it will
28
28
cycle through other command matches such as ` cherry ` and ` cherry-pick ` . You can also tab complete remote names and
29
- branch names e.g.: ` git pull or<tab> ma<tab> ` tab completes to ` git pull origin master ` .
29
+ branch names e.g.: ` git pull or<tab> ma<tab> ` tab completes to ` git pull origin main ` .
30
30
31
31
## Versions
32
32
@@ -36,7 +36,7 @@ branch names e.g.: `git pull or<tab> ma<tab>` tab completes to `git pull origin
36
36
| --------------------| ----------------------| ----------------------|
37
37
| [ ![ master build status] [ av-master-img ]] [ av-master-site ] | [ ![ master build status] [ tv-master-img ]] [ tv-master-site ] | [ ![ master build coverage] [ cc-master-img ]] [ cc-master-site ] |
38
38
39
- [ README] [ v1 -readme] • [ CHANGELOG] [ v1 -change]
39
+ [ README] [ main -readme] • [ CHANGELOG] [ main -change]
40
40
41
41
- Supports Windows PowerShell 5.x
42
42
- Supports PowerShell Core 6+ on all platforms
@@ -46,6 +46,8 @@ branch names e.g.: `git pull or<tab> ma<tab>` tab completes to `git pull origin
46
46
47
47
#### Releases
48
48
49
+ - v1.0.0
50
+ ( [ README] [ v1-readme ] • [ CHANGELOG] [ v1-change ] )
49
51
- v1.0.0-beta5
50
52
( [ README] [ v1b5-readme ] • [ CHANGELOG] [ v1b5-change ] )
51
53
- v1.0.0-beta4
@@ -248,10 +250,10 @@ By default, the status summary has the following format:
248
250
249
251
The symbols and surrounding text can be customized by the corresponding properties on ` $GitPromptSettings ` .
250
252
251
- For example, a status of ` [master ≡ +0 ~2 -1 | +1 ~1 -0] ` corresponds to the following ` git status ` :
253
+ For example, a status of ` [main ≡ +0 ~2 -1 | +1 ~1 -0] ` corresponds to the following ` git status ` :
252
254
253
255
``` powershell
254
- # On branch master
256
+ # On branch main
255
257
#
256
258
# Changes to be committed:
257
259
# (use "git reset HEAD <file>..." to unstage)
@@ -292,7 +294,7 @@ function.
292
294
293
295
The prompt function provided by posh-git creates a prompt that looks like this:
294
296
295
- ![ ~ \GitHub\posh-git [ master ≡] > ] [ prompt-default ]
297
+ ![ ~ \GitHub\posh-git [ main ≡] > ] [ prompt-default ]
296
298
297
299
You can customize the posh-git prompt function or define your own custom prompt function.
298
300
The rest of this section covers how to customize posh-git's prompt function using the global variable
@@ -310,7 +312,7 @@ $GitPromptSettings.DefaultPromptPrefix.ForegroundColor = [ConsoleColor]::Magenta
310
312
311
313
This will change the prompt to:
312
314
313
- ![ 02-18 13:45:19 ~ \GitHub\posh-git [ master ≡] > ] [ prompt-prefix ]
315
+ ![ 02-18 13:45:19 ~ \GitHub\posh-git [ main ≡] > ] [ prompt-prefix ]
314
316
315
317
If you would prefer not to have any path under your home directory abbreviated with ` ~ ` , use the following setting:
316
318
@@ -320,7 +322,7 @@ $GitPromptSettings.DefaultPromptAbbreviateHomeDirectory = $false
320
322
321
323
This will change the prompt to:
322
324
323
- ![ C:\Users\Keith\GitHub\posh-git [ master ≡] > ] [ prompt-no-abbr ]
325
+ ![ C:\Users\Keith\GitHub\posh-git [ main ≡] > ] [ prompt-no-abbr ]
324
326
325
327
If you would like to change the color of the path, you can use the following setting on Windows:
326
328
@@ -340,7 +342,7 @@ $GitPromptSettings.DefaultPromptPath.ForegroundColor = 0xFFA500
340
342
341
343
This will change the prompt to:
342
344
343
- ![ ~ \GitHub\posh-git [ master ] > ] [ prompt-path ]
345
+ ![ ~ \GitHub\posh-git [ main ] > ] [ prompt-path ]
344
346
345
347
If you would like to make your prompt span two lines, with a newline after the Git status summary, use this setting:
346
348
@@ -350,7 +352,7 @@ $GitPromptSettings.DefaultPromptBeforeSuffix.Text = '`n'
350
352
351
353
This will change the prompt to:
352
354
353
- ![ ~ \GitHub\posh-git [ master ≡] 
 ; > ] [ prompt-two-line ]
355
+ ![ ~ \GitHub\posh-git [ main ≡] 
 ; > ] [ prompt-two-line ]
354
356
355
357
You can swap the order of the path and the Git status summary with the following setting:
356
358
@@ -360,7 +362,7 @@ $GitPromptSettings.DefaultPromptWriteStatusFirst = $true
360
362
361
363
This will change the prompt to:
362
364
363
- ![ [ master ≡] ~ \GitHub\posh-git> ] [ prompt-swap ]
365
+ ![ [ main ≡] ~ \GitHub\posh-git> ] [ prompt-swap ]
364
366
365
367
Finally, you can combine these settings to customize the posh-git prompt fairly significantly.
366
368
In the ` DefaultPromptSuffix ` field below, we are prepending the PowerShell history id number before the prompt
@@ -375,7 +377,7 @@ $GitPromptSettings.DefaultPromptSuffix = ' $((Get-History -Count 1).id + 1)$(">"
375
377
376
378
This will change the prompt to:
377
379
378
- ![ [ master ≡] ~ \GitHub\posh-git
 ; 02-18 14:04:35 38> ] [ prompt-custom ]
380
+ ![ [ main ≡] ~ \GitHub\posh-git
 ; 02-18 14:04:35 38> ] [ prompt-custom ]
379
381
380
382
Finally, the path portion of the prompt can be contained within delimiters.
381
383
For instance, if you would like the containing characters to be red, curly braces, the following settings can be used:
@@ -389,7 +391,7 @@ $GitPromptSettings.AfterPath.ForegroundColor = 'Red'
389
391
390
392
With these additional values, the previous prompt would become
391
393
392
- ![ [ master ≡] {~ \GitHub\posh-git}
 ; 02-18 14:04:35 38> ] [ prompt-custom-wpathdelim ]
394
+ ![ [ main ≡] {~ \GitHub\posh-git}
 ; 02-18 14:04:35 38> ] [ prompt-custom-wpathdelim ]
393
395
394
396
### Prompt Layouts
395
397
@@ -434,11 +436,11 @@ $global:GitPromptSettings.DefaultPromptBeforeSuffix.Text = '`n$(PromptWriteError
434
436
435
437
When a PowerShell command fails, this is the prompt you will see:
436
438
437
- ![ ~ \GitHub\posh-git [ master ≡] 
 ; ! 07-01 22:36:31> ] [ prompt-error1 ]
439
+ ![ ~ \GitHub\posh-git [ main ≡] 
 ; ! 07-01 22:36:31> ] [ prompt-error1 ]
438
440
439
441
When an external application returns a non-zero exit code, 1 in this case, you will see the exit code in the prompt:
440
442
441
- ![ ~ \GitHub\posh-git [ master ≡] 
 ; (1) 07-01 22:32:28> ] [ prompt-error2 ]
443
+ ![ ~ \GitHub\posh-git [ main ≡] 
 ; (1) 07-01 22:32:28> ] [ prompt-error2 ]
442
444
443
445
Note that until you run an external application that sets ` $LASTEXITCODE ` to zero or you manually set the variable to
444
446
0, you will see the exit code for any error. In addition to ` LastExitCode ` and ` DollarQuestion ` ,
@@ -509,22 +511,22 @@ function prompt {
509
511
[ choco-site ] : https://chocolatey.org/packages/poshgit/
510
512
[ psgallery-img ] : https://img.shields.io/powershellgallery/dt/posh-git.svg
511
513
[ psgallery-site ] : https://www.powershellgallery.com/packages/posh-git
512
- [ psgallery-v1 ] : https://www.powershellgallery.com/packages/posh-git/1.0.0-beta5
514
+ [ psgallery-v1 ] : https://www.powershellgallery.com/packages/posh-git/1.0.0
513
515
[ w3c-colors ] : https://www.w3schools.com/colors/colors_names.asp
514
516
515
517
[ posh-sshell-url ] : https://github.com/dahlbyk/posh-sshell
516
518
517
- [ prompt-def-long ] : https://github.com/dahlbyk/posh-git/wiki/images/PromptDefaultLong.png " ~\GitHub\posh-git [master ≡ +0 ~1 -0 | +0 ~1 -0 !]> "
518
- [ prompt-default ] : https://github.com/dahlbyk/posh-git/wiki/images/PromptDefault.png " ~\GitHub\posh-git [master ≡]> "
519
- [ prompt-prefix ] : https://github.com/dahlbyk/posh-git/wiki/images/PromptPrefix.png " 02-18 13:45:19 ~\GitHub\posh-git [master ≡]> "
520
- [ prompt-no-abbr ] : https://github.com/dahlbyk/posh-git/wiki/images/PromptNoAbbrevHome.png " C:\Users\Keith\GitHub\posh-git [master ≡]> "
521
- [ prompt-path ] : https://github.com/dahlbyk/posh-git/wiki/images/PromptOrangePath.png " ~\GitHub\posh-git [master ≡]> "
522
- [ prompt-swap ] : https://github.com/dahlbyk/posh-git/wiki/images/PromptStatusFirst.png " [master ≡] ~\GitHub\posh-git> "
523
- [ prompt-two-line ] : https://github.com/dahlbyk/posh-git/wiki/images/PromptTwoLine.png " ~\GitHub\posh-git [master ≡]
 ; > "
524
- [ prompt-custom ] : https://github.com/dahlbyk/posh-git/wiki/images/PromptCustom.png " [master ≡] ~\GitHub\posh-git
 ; 02-18 14:04:35 38> "
525
- [ prompt-custom-wpathdelim ] : https://github.com/dahlbyk/posh-git/wiki/images/PromptCustomDelim.png " [master ≡] {~\GitHub\posh-git}
 ; 02-18 14:04:35 38> "
526
- [ prompt-error1 ] : https://github.com/dahlbyk/posh-git/wiki/images/PromptError1.png " ~\GitHub\posh-git [master ≡]
 ; ! 07-01 22:36:31> "
527
- [ prompt-error2 ] : https://github.com/dahlbyk/posh-git/wiki/images/PromptError2.png " ~\GitHub\posh-git [master ≡]
 ; (1) 07-01 22:32:28> "
519
+ [ prompt-def-long ] : https://github.com/dahlbyk/posh-git/wiki/images/PromptDefaultLong.png " ~\GitHub\posh-git [main ≡ +0 ~1 -0 | +0 ~1 -0 !]> "
520
+ [ prompt-default ] : https://github.com/dahlbyk/posh-git/wiki/images/PromptDefault.png " ~\GitHub\posh-git [main ≡]> "
521
+ [ prompt-prefix ] : https://github.com/dahlbyk/posh-git/wiki/images/PromptPrefix.png " 02-18 13:45:19 ~\GitHub\posh-git [main ≡]> "
522
+ [ prompt-no-abbr ] : https://github.com/dahlbyk/posh-git/wiki/images/PromptNoAbbrevHome.png " C:\Users\Keith\GitHub\posh-git [main ≡]> "
523
+ [ prompt-path ] : https://github.com/dahlbyk/posh-git/wiki/images/PromptOrangePath.png " ~\GitHub\posh-git [main ≡]> "
524
+ [ prompt-swap ] : https://github.com/dahlbyk/posh-git/wiki/images/PromptStatusFirst.png " [main ≡] ~\GitHub\posh-git> "
525
+ [ prompt-two-line ] : https://github.com/dahlbyk/posh-git/wiki/images/PromptTwoLine.png " ~\GitHub\posh-git [main ≡]
 ; > "
526
+ [ prompt-custom ] : https://github.com/dahlbyk/posh-git/wiki/images/PromptCustom.png " [main ≡] ~\GitHub\posh-git
 ; 02-18 14:04:35 38> "
527
+ [ prompt-custom-wpathdelim ] : https://github.com/dahlbyk/posh-git/wiki/images/PromptCustomDelim.png " [main ≡] {~\GitHub\posh-git}
 ; 02-18 14:04:35 38> "
528
+ [ prompt-error1 ] : https://github.com/dahlbyk/posh-git/wiki/images/PromptError1.png " ~\GitHub\posh-git [main ≡]
 ; ! 07-01 22:36:31> "
529
+ [ prompt-error2 ] : https://github.com/dahlbyk/posh-git/wiki/images/PromptError2.png " ~\GitHub\posh-git [main ≡]
 ; (1) 07-01 22:32:28> "
528
530
529
531
[ v0-change ] : https://github.com/dahlbyk/posh-git/blob/v0/CHANGELOG.md
530
532
[ v0-readme ] : https://github.com/dahlbyk/posh-git/blob/v0/README.md
@@ -538,8 +540,8 @@ function prompt {
538
540
[ v073-change ] : https://github.com/dahlbyk/posh-git/blob/v0.7.3/CHANGELOG.md
539
541
[ v073-readme ] : https://github.com/dahlbyk/posh-git/blob/v0.7.3/README.md
540
542
541
- [ v1 -change] : https://github.com/dahlbyk/posh-git/blob/master/CHANGELOG.md
542
- [ v1 -readme] : https://github.com/dahlbyk/posh-git/blob/master/README.md
543
+ [ main -change] : https://github.com/dahlbyk/posh-git/blob/master/CHANGELOG.md
544
+ [ main -readme] : https://github.com/dahlbyk/posh-git/blob/master/README.md
543
545
544
546
[ v1b1-change ] : https://github.com/dahlbyk/posh-git/blob/v1.0.0-beta1/CHANGELOG.md
545
547
[ v1b1-readme ] : https://github.com/dahlbyk/posh-git/blob/v1.0.0-beta1/README.md
@@ -556,4 +558,8 @@ function prompt {
556
558
[ v1b5-change ] : https://github.com/dahlbyk/posh-git/blob/v1.0.0-beta5/CHANGELOG.md
557
559
[ v1b5-readme ] : https://github.com/dahlbyk/posh-git/blob/v1.0.0-beta5/README.md
558
560
561
+ [ v1-change ] : https://github.com/dahlbyk/posh-git/blob/v1.0.0/CHANGELOG.md
562
+ [ v1-readme ] : https://github.com/dahlbyk/posh-git/blob/v1.0.0/README.md
563
+
564
+
559
565
[ wiki-custom-prompt ] : https://github.com/dahlbyk/posh-git/wiki/Customizing-Your-PowerShell-Prompt
0 commit comments