Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git: fatal: A branch named 'master' already exists

Tags:

git

I want to To checkout branch which not exists locally but is in the remote repo

>git checkout -t -b master origin/master
fatal: A branch named 'master' already exists.

and when I browse the git project using a browser I only see a develop branch

like image 689
Nunyet de Can Calçada Avatar asked Apr 06 '16 10:04

Nunyet de Can Calçada


People also ask

How do I remove a remote git branch?

To completely remove a remote branch, you need to use the git push origin command with a -d flag, then specify the name of the remote branch. So the syntax representing the command for removing a remote branch looks like this: git push origin -d branch-name .

Can't delete branch checked?

Delete a local branch You can't delete a branch if you're checked out that branch. You will see this error: Cannot delete branch 'branch-name' checked out at 'some-location'. To fix this, you will have to switch to a different branch. -d is shortcut for —-delete and it deletes a branch.

Can we delete a branch in git?

Deleting a branch LOCALLYDelete a branch with git branch -d <branch> . The -d option will delete the branch only if it has already been pushed and merged with the remote branch. Use -D instead if you want to force the branch to be deleted, even if it hasn't been pushed or merged yet. The branch is now deleted locally.


1 Answers

You answer should be : git checkout master.

like image 180
dvxam Avatar answered Oct 15 '22 02:10

dvxam