Created
June 18, 2019 13:39
-
-
Save piraces/e4af2ad13897e4dad3b616c8180afd26 to your computer and use it in GitHub Desktop.
Powershell script to rename a branch in Git
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
$oldName = "feature/fix" | |
$newName = "feature/fixes" | |
$directory = "C:\Projects\Folder" | |
Set-Location -Path $directory | |
git fetch | |
git checkout $oldName | |
git pull | |
git branch -m $newName | |
git branch -m $oldName $newName | |
git push origin :$oldName $newName | |
git push origin -u $newName |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment