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
# creates a branch called some_branch
# switches to this newly created branch
# pulls changes from the origin remote branch
git checkout -b some_branch origin/some_branch
git fetch
git reset --hard origin/{{branch}}
# replace {{branch}} with name
git branch branch_name --set-upstream-to your_new_remote/branch_name
Delete your local branch: git branch -d local_branch
Fetch the latest remote branch: git fetch origin remote_branch
Rebuild the local branch based on the remote one: git checkout -b local_branch origin/remote_branch
git branch branch_name -u your_new_remote/branch_name
Code Example |
---|
Shell :: install bootstrap vue laravel 7 |
:: |
Shell :: |
Shell :: |
Shell :: |
:: remote: Bitbucket Cloud recently stopped supporting account passwords for Git authentication |
Shell :: |
:: |
:: |
:: cuda driver install in ubuntu |
Shell :: how to revert to last git commit |
Shell :: could not find tools.jar linux |
:: |
:: primary git commands |
:: added changes to a specific commit |
Shell :: npm version |
Shell :: uniq bash |
Shell :: How to count number of files in each directory |
:: gitlab ci yml example |
Shell :: |
:: "GH001: Large files detected. You may want to try Git Large File Storage" error fix |
Shell :: how to start cron job |
Shell :: |
Shell :: ssh timeout |
:: |
:: curl install docker-compose linux |
Shell :: |
:: revert last commit git |
Shell :: git merge example |
Shell :: how to paste in git bash |