-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSet-GitConfig.ps1
More file actions
64 lines (55 loc) · 1.54 KB
/
Set-GitConfig.ps1
File metadata and controls
64 lines (55 loc) · 1.54 KB
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
[CmdLetBinding()]
param(
[switch]$vim,
[switch]$Force,
$beyond = (get-command bcomp).Definition,
$workEmail = "[email protected]"
)
function Set-GitGlobals()
{
if (Test-Path "~/.gitconfig") {
if ($Force) {
Remove-Item "~/.gitconfig" -Force
Write-Verbose "Removing old config"
} else {
Write-Verbose "Git Config already exists, use -Force to overwrite"
return;
}
}
git config --global user.name "Oscar Calvo"
if ("${env:USERNAME}${env:USER}" -eq "ocalvo")
{
git config --global user.email $workEmail
}
else
{
git config --global user.email "[email protected]"
}
git config --global log.date local
git config --global submodule.recurse true
if (Test-Path env:WinDir) {
git config --global core.autocrlf true
git config --global core.eol crlf
git config --global core.sshCommand "C:/Windows/System32/OpenSSH/ssh.exe"
} else {
git config --global core.autocrlf input
git config --global core.eol lf
}
if ($beyond -ne $null)
{
git config --global diff.tool bc
git config --global difftool.prompt false
git config --global difftool.bc trustExitCode true
git config --global merge.tool bc
git config --global mergetool.prompt false
git config --global mergetool.bc trustExitCode true
git config --global difftool.bc.path $beyond
git config --global mergetool.bc.path $beyond
if ($vim.IsPresent)
{
git config --global diff.tool vimdiff
git config --global merge.tool vimdiff
}
}
}
Set-GitGlobals