mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-15 04:24:01 +01:00
Update configure-git.ps1
This commit is contained in:
parent
50614a4399
commit
0857703870
@ -31,13 +31,7 @@ try {
|
||||
if ($EmailAddress -eq "") { $EmailAddress = read-host "Enter your e-mail address"}
|
||||
if ($FavoriteEditor -eq "") { $FavoriteEditor = read-host "Enter your favorite text editor (atom,emacs,nano,subl,vi,vim,...)" }
|
||||
|
||||
"⏳ (3/6) Saving personal settings (name,email,editor)..."
|
||||
& git config --global user.name $FullName
|
||||
& git config --global user.email $EmailAddress
|
||||
& git config --global core.editor $FavoriteEditor
|
||||
if ($lastExitCode -ne "0") { throw "'git config' failed with exit code $lastExitCode" }
|
||||
|
||||
"⏳ (4/6) Saving basic settings (autocrlf,symlinks,longpaths,etc.)..."
|
||||
"⏳ (3/6) Saving basic settings (autocrlf,symlinks,longpaths,etc.)..."
|
||||
& git config --global core.autocrlf false # don't change newlines
|
||||
& git config --global core.symlinks true # enable support for symbolic link files
|
||||
& git config --global core.longpaths true # enable support for long file paths
|
||||
@ -48,7 +42,13 @@ try {
|
||||
& git config --global fetch.parallel 0 # enable parallel fetching to improve the speed
|
||||
if ($lastExitCode -ne "0") { throw "'git config' failed with exit code $lastExitCode" }
|
||||
|
||||
"⏳ (5/6) Saving shortcuts (git co, git br, etc.)..."
|
||||
"⏳ (4/6) Saving personal settings (name,email,editor)..."
|
||||
& git config --global user.name $FullName
|
||||
& git config --global user.email $EmailAddress
|
||||
& git config --global core.editor $FavoriteEditor
|
||||
if ($lastExitCode -ne "0") { throw "'git config' failed with exit code $lastExitCode" }
|
||||
|
||||
"⏳ (5/6) Saving personal shortcuts (git co, git br, etc.)..."
|
||||
& git config --global alias.co "checkout"
|
||||
& git config --global alias.br "branch"
|
||||
& git config --global alias.ci "commit"
|
||||
@ -61,14 +61,14 @@ try {
|
||||
& git config --global alias.smu "submodule update --init"
|
||||
if ($lastExitCode -ne "0") { throw "'git config' failed" }
|
||||
|
||||
"⏳ (6/6) Listing your Git settings..."
|
||||
"⏳ (6/6) Listing your current settings..."
|
||||
& git config --list
|
||||
if ($lastExitCode -ne "0") { throw "'git config --list' failed with exit code $lastExitCode" }
|
||||
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ configured Git in $Elapsed sec."
|
||||
"✔️ configured Git in $Elapsed sec"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber)): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user