Copy git config --global alias.ignore \
'!gi() { curl -sL https://www.toptal.com/developers/gitignore/api/$@ ;}; gi'
Copy echo "function gi() { curl -sL https://www.toptal.com/developers/gitignore/api/\$@ ;}" >> \
~/.bashrc && source ~/.bashrc
Copy echo "function gi() { curl -sLw \"\\\n\" https://www.toptal.com/developers/gitignore/api/\$@ ;}" >> \
~/.zshrc && source ~/.zshrc
Copy printf "function gi\n\tcurl -sL https://www.toptal.com/developers/gitignore/api/\$argv\nend\n" > \
~/.config/fish/functions/gi.fish
Copy echo "function gi() { curl -sL https://www.toptal.com/developers/gitignore/api/\$@ ;}" >> \
~/.bash_profile && source ~/.bash_profile
Copy echo "function gi() { curl -sLw \"\\\n\" https://www.toptal.com/developers/gitignore/api/\$@ ;}" >> \
~/.zshrc && source ~/.zshrc
Copy printf "function gi\n\tcurl -sL https://www.toptal.com/developers/gitignore/api/\$argv\nend\n" > \
~/.config/fish/functions/gi.fish
Copy #For PowerShell v3
Function gig {
param(
[Parameter(Mandatory = $true)]
[string[]]$list
)
$params = ($list | ForEach-Object { [uri]::EscapeDataString($_) }) -join ","
Invoke-WebRequest -Uri "https://www.toptal.com/developers/gitignore/api/$params" | select -ExpandProperty content | Out-File -FilePath $( Join-Path -path $pwd -ChildPath ".gitignore" ) -Encoding ascii
}
Copy #For PowerShell v2
Function gig {
param(
[Parameter(Mandatory = $true)]
[string[]]$list
)
$params = ($list | ForEach-Object { [uri]::EscapeDataString($_) }) -join ","
$wc = New-Object System.Net.WebClient
$wc .Headers[ "User-Agent" ] = "PowerShell/" + $PSVersionTable [ "PSVersion" ].ToString ()
$wc .DownloadFile ( "https://www.toptal.com/developers/gitignore/api/$params" , "$PWD\.gitignore" )
}
Copy @rem Do not use "echo off" to not affect any child calls.
@setlocal
@rem Get the abolute path to the parent directory, which is assumed to be the
@rem Git installation root.
@for /F "delims=" %%I in ( "%~dp0.." ) do @set git_install_root=%%~fI
@for /F "delims=" %%I in ( "%~dp0.." ) do @set git_mingw_root=%%~fI \m ingw
@if not exist "%git_mingw_root%" @set git_mingw_root=%git_install_root% \m ingw64
@set PATH=%git_install_root% \b in ; %git_mingw_root%\bin ; %PATH%
@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
@if not exist "%HOME%" @set HOME=%USERPROFILE%
@curl.exe -L -s https://www.toptal.com/developers/gitignore/api/%*