Horje
rename a git branch Code Example
git rename remote branch
# Rename the local branch to the new name
git branch -m <old_name> <new_name>

# Delete the old branch on remote - where <remote> is, for example, origin
git push <remote> --delete <old_name>

# Or shorter way to delete remote branch [:]
git push <remote> :<old_name>

# Push the new branch to remote
git push <remote> <new_name>

# Reset the upstream branch for the new_name local branch
git push <remote> -u <new_name>
How do I rename a local Git branch?
If you want to rename a branch while pointed to any branch, do:

git branch -m <oldname> <newname> 
If you want to rename the current branch, you can do:

git branch -m <newname> 
If you want to push the local branch and reset the upstream branch:

git push origin -u <newname> 
And finally if you want to Delete the remote branch:

git push origin --delete <oldname> 
A way to remember this is -m is for "move" (or mv), which is how you rename files. Adding an alias could also help. To do so, run the following:

git config --global alias.rename 'branch -m' 
If you are on Windows or another case-insensitive filesystem, and there are only capitalization changes in the name, you need to use -M, otherwise, git will throw branch already exists error:

git branch -M <newname> 
rename remote branch in git
git push origin :<branch_to_rename>
git checkout -b <new_branch_name>
git push --set-upstream origin <new_branch_name>
git rename branch
git push origin :old-name new-name
git rename branch
git push origin –u new-name
rename a git branch
# suppose u r on branch test1 n want to rename it to test2
git branch -m <newName>
#example
git branch -m test2
# if u r on branch test1 and want to change another branch test2 
git branch -m <oldName> <newName>
#example 
git branch -m test2 test3




Shell

Related
what is shell scripting Code Example what is shell scripting Code Example
how to use snapcraft Code Example how to use snapcraft Code Example
redis cli docker Code Example redis cli docker Code Example
how to install snapcraft Code Example how to install snapcraft Code Example
view a git log for a specific file Code Example view a git log for a specific file Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
12