Last active
August 18, 2021 02:43
-
-
Save warm-ice0x00/4d63513b7f84bc1d673ce92324378cff to your computer and use it in GitHub Desktop.
Universal Git Script (PowerShell Version)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[CmdletBinding()] param([Parameter(Mandatory = $true)] [string]$Url) | |
$dotGitPath = Join-Path -Path $PWD -ChildPath .git | |
Remove-Item -LiteralPath $dotGitPath -Force -Recurse -ErrorAction SilentlyContinue | |
& git init | |
& git remote add origin $Url | |
& git add -A | |
& git reset $MyInvocation.MyCommand.Definition | |
& git commit -am 'Initial commit' | |
& git push -f origin master | |
Remove-Item -LiteralPath $dotGitPath -Force -Recurse | |
Write-Output -InputObject 'Done! If there is a problem, rerun the script.' | |
#Inspired by xkcd: Git https://xkcd.com/1597/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment