mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-10 18:58:21 +02:00
Improve create-branch.ps1
This commit is contained in:
parent
a43b74e238
commit
7c64b370cf
@ -19,8 +19,11 @@ try {
|
||||
if ($lastExitCode -ne "0") { throw "'git status' failed in $RepoDir" }
|
||||
if ("$Result" -notmatch "nothing to commit, working tree clean") { throw "Repository is NOT clean: $Result" }
|
||||
|
||||
& "$PSScriptRoot/fetch-repo.ps1"
|
||||
if ($lastExitCode -ne "0") { throw "Script 'fetch-repo.ps1' failed" }
|
||||
$RepoDirName = (get-item "$RepoDir").Name
|
||||
"⏳ Fetching updates for Git repository 📂$RepoDirName ..."
|
||||
|
||||
& git fetch --all --recurse-submodules --jobs=4
|
||||
if ($lastExitCode -ne "0") { throw "'git fetch' failed" }
|
||||
|
||||
& git checkout -b "$NewBranchName"
|
||||
if ($lastExitCode -ne "0") { throw "'git checkout -b $NewBranchName' failed" }
|
||||
@ -31,7 +34,7 @@ try {
|
||||
& git submodule update --init --recursive
|
||||
if ($lastExitCode -ne "0") { throw "'git submodule update' failed" }
|
||||
|
||||
"✔️ created new branch 🌵$NewBranchName in Git repository $RepoDir"
|
||||
"✔️ created new 🌵$NewBranchName branch in Git repository 📂$RepoDirName"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
Loading…
Reference in New Issue
Block a user