Linked Questions

4 votes
1 answer
6k views

How do I rename the local Git branch? [duplicate]

I don't want to rename a remote branch, as described in Rename master branch for both local and remote Git repositories. How can I rename a local branch which hasn't been pushed to a remote branch? In ...
  • 43
4 votes
1 answer
8k views

How to rename and move branch in git (bitucket/sourcetree) [duplicate]

We have a branch called ABC-Awsome_Branch , that is "saved" in feature/3.0.0, so it looks like: feature/3.0.0/ABC-Awsome_Branch But the branch was created with an incorrect name, and even not in the ...
  • 7,606
6 votes
1 answer
2k views

move a branch path in git (change its name, not its code) [duplicate]

we have a branch on remote called release/service-release-2016 I want to rename the branch to release/completed/service-release-2016 for archiving and clarity. How do I do this? Everything I ...
7 votes
0 answers
135 views

Rename local branch not pused in remote [duplicate]

I've created a new branch in local with below command and started working on code changes. master> git checkout -b "mybranch" Later, I realized that I needed to follow our standard and that I ...
1238 votes
15 answers
745k views

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

I have a local branch master that points to a remote branch origin/regacy (oops, typo!). How do I rename the remote branch to origin/legacy or origin/master? I tried: git remote rename regacy legacy ...
  • 13k
876 votes
17 answers
316k views

Rename master branch for both local and remote Git repositories

I have the branch master which tracks the remote branch origin/master. I want to rename them to master-old both locally and on the remote. Is this possible? For other users who tracked origin/...
  • 63.3k
433 votes
10 answers
323k views

Renaming branches remotely in Git

If there is a repository that I only have git:// access to (and would usually just push+pull), is there a way to rename branches in that repository in the same way that I would do locally with git ...
  • 27.4k
329 votes
2 answers
183k views

Change a branch name in a Git repo

How do I rename an existing branch in a Git repo? I want the current branch to have a new name.
  • 3,315
132 votes
8 answers
86k views

How do I rename my Git 'master' branch to 'release'?

We would like to enforce a new policy for our projects that the master branch now be called the release branch to ensure it is more clear as to how the branch should be used. Naturally, we will have ...
  • 5,186
46 votes
3 answers
23k views

How can I rename my branch from TortoiseGit?

I know the way to rename branch from command line, but - since I'm using TortoiseGit - I'm curious if there are any options to do such thing. Thanks for the answers :)
20 votes
4 answers
22k views

git branch -M main

One of the things github now recommends is changing the branch to main instead of master. The code given on the github site is: git branch -M main That never works for me, so I thought I would ...
13 votes
4 answers
20k views

Git problems with git push --all

I have a base repository that lives on a UNC \machine\share ....etc. I have a local clone that I work on in the master branch and occasionally merge over to the "stable" branch. usually I do a git ...
12 votes
2 answers
8k views

Can't checkout git branch started with hyphen (-)

I have cloned a git repository. This repository has a remote branch something like -feature-abc. When I type git checkout -feature-abc, I get: error: unknown switch `e' Any idea how to checkout this ...
  • 3,459
9 votes
1 answer
39k views

How to make Head point to master in git?

Please help to make Head point to master in git I tried to git rebase HEAD master and git checkout master Nothing of those helps. Updated: Strange I tried: git symbolic-ref HEAD refs/heads/...
  • 1,054
3 votes
2 answers
4k views

Group git branches

I've taken over a big git repository with lots of branches that no one really seems to know what they are all about. Is there any way to put branches in some kind of grouping or folder so that they ...
  • 2,770

15 30 50 per page