Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

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>
Comment

rename branch remotely git

git push origin :old-name
git push origin new-name
Comment

Git change remote branch name

1. Verify the local branch has the correct name:
git branch -a

2. Next, delete the branch with the old name on the remote repository:
git push origin ––delete old-name

3. Finally, push the branch with the correct name, and reset the upstream branch:
git push origin –u new-name

Alternatively, you can overwrite the remote branch with a single command:
git push origin :old-name new-name
Resetting the upstream branch is still required:
git push origin –u new-name
Comment

Rename git branch remote and local

# 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>

# Prevent git from using the old name when pushing in the next step.
# Otherwise, git will use the old upstream name instead of <new_name>.
git branch --unset-upstream <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>
Comment

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>
Comment

rename branch remote

git branch -m new_name
git push <remote> :old_name new_name
Comment

PREVIOUS NEXT
Code Example
Shell :: download vs code in linux 
Shell :: install flutter ubuntu 20.04 
Shell :: source fish config 
Shell :: remove mariadb 
Shell :: device manager cmd command 
Shell :: install godot ubuntu 
Shell :: cshell find file by name 
Shell :: anydesk linux install download 
Shell :: mocha zsh: command not found: mocha 
Shell :: install GTK 3.0 on fedora 
Shell :: cannot update snap namespace: cannot create symlink in "/etc/docker": existing file in the way snap-update-ns failed with code 1 
Shell :: echo aws profile 
Shell :: avoid github credentials 
Shell :: git change personal access token command line 
Shell :: zsh command not found: flutterfire 
Shell :: install composer wsl 
Shell :: number of files in a folder 
Shell :: linux repository list 
Shell :: check if virtualbox is installed ubuntu 
Shell :: reboot server linux 
Shell :: Waiting for your editor to close the file... 
Shell :: how to clone my linux so all the installed packages 
Shell :: powershell delete files older than 15 days 
Shell :: how to find empty directories in linux 
Shell :: ubuntu passwordless sudo 
Shell :: libgit2.so.1.1: cannot open shared object file: No such file or directory 
Shell :: locate all exe file in powershell 
Shell :: kill port in kali linux 
Shell :: java check java version 
Shell :: powershell get ip from computer name 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =