Last active
July 19, 2024 13:48
-
-
Save chuckntaylor/6fef7aebc22350c7974abf08e344a61d to your computer and use it in GitHub Desktop.
Revisions
-
chuckntaylor revised this gist
Jul 19, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ git push origin <new_name> ``` Delete the old branch on the remote repository: ** NOTE: With GitHub, you can't delete a branch through the web interface if it's the default branch of the repository. You can change the default branch in the repository settings. ** ```bash git push origin :<old_name> -
chuckntaylor revised this gist
Jul 19, 2024 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -13,6 +13,7 @@ git push origin <new_name> ``` Delete the old branch on the remote repository: NOTE: With GitHub, you can't delete a branch through the web interface if it's the default branch of the repository. You can change the default branch in the repository settings. ```bash git push origin :<old_name> -
chuckntaylor revised this gist
Jul 19, 2024 . 1 changed file with 40 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1 +1,40 @@ # Renaming both a local and remote branch First, rename the local branch by typing: ```bash git branch -m <old_name> <new_name> ``` Then push the new branch to the remote repository: ```bash git push origin <new_name> ``` Delete the old branch on the remote repository: ```bash git push origin :<old_name> ``` Finally, reset the upstream branch for the new_name local branch: ```bash git push origin -u <new_name> ``` # Renaming a remote branch If you only want to rename a remote branch, you can do so by: ```bash git push origin <old_name>:<new_name> git push origin :<old_name> ``` Finally, reset the upstream branch for the new_name local branch: ```bash git push origin -u <new_name> ``` -
chuckntaylor created this gist
Jul 19, 2024 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@