Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rename a remote branch using TortoiseGit?

I have seen a few questions about this, like:

How do I rename both a Git local and remote branch name?

But I am using TortoiseGit.

As you can see:

Branches

I recently renamed my local branch from ImportPTS to import-publictalk-names. I have just pushed my commit from the new named branch to the existing remote named branch.

But I would like the remote named branch to match. Can we do this with TortoiseGit? I tried with the Browser Ref window and couldn't see it.

like image 946
Andrew Truckle Avatar asked Jan 21 '17 13:01

Andrew Truckle


People also ask

How do I rename a remote branch?

To be precise, renaming a remote branch is not direct – you have to delete the old remote branch name and then push a new branch name to the repo. Step 2: Reset the upstream branch to the name of your new local branch by running git push origin -u new-branch-name .

Can we rename the remote branch name in git?

The steps to change a git branch name are: Rename the Git branch locally with the git branch -m new-branch-name command. Push the new branch to your GitHub or GitLab repo. Delete the branch with the old name from your remote repo.

How do I change my name on Tortoisegit?

If you want to do a simple in-place rename of a file or folder, use Context Menu → Rename... Enter the new name for the item and you're done.


1 Answers

Open the push dialog and enter a different name for "remote branch". In order to automatically select the name branch for pushing and pulling, also select "Set upstream/track remote branch". After that the old remote branch can be deleted (e.g., using the log dialog).

Remote branches exist in the remote repository, but also have a "local" corresponding branch named remotes/NAME/branchname. Additionally, you have local branches which can have a remote tracked branch, which is a branch name which exists on a remote repository and which is used automatically for pulling and pushing.

like image 190
MrTux Avatar answered Nov 04 '22 06:11

MrTux