0

I am new to Git , in my project they are currently using git . So i am not sure on my Name how one more duplicate branch got created , it might be by me that i am not sure .

Now I need to remove the duplicate branch which git created which out disturbing the main branch and the sub branch .

Any help !!!

sam
  • 57
  • 6
  • What do you mean by duplicate branch? You can’t have two branches named the same. May you add more information to the question so we don’t need to guess? – evolutionxbox Oct 08 '20 at 11:15
  • one in upper case and one in lowercase "Swagatika" and another one is "swagatika" – sam Oct 08 '20 at 11:16
  • Do you know how to delete a branch? If not I’d recommend reading up on the basics of git first. – evolutionxbox Oct 08 '20 at 11:19
  • This might be helpful: https://stackoverflow.com/questions/2003505/how-do-i-delete-a-git-branch-locally-and-remotely – user1729210 Oct 08 '20 at 11:34

1 Answers1

2

Newbie? First, make a backup.

cp -r your/repo/dir your/repo/dir.bck

Use

git branch -d branchname

to delete the branch with name branchname

You can lookup a detailed manual with

git branch --help

This will say

-d, --delete Delete a branch. The branch must be fully merged in its upstream branch, or in HEAD if no upstream was set with --track or --set-upstream-to.

-D Shortcut for --delete --force.

It will also give you an example

Delete an unneeded branch

          $ git clone git://git.kernel.org/.../git.git my.git
          $ cd my.git
          $ git branch -d -r origin/todo origin/html origin/man   (1)
          $ git branch -D test                                    (2)>
  1. Delete the remote-tracking branches "todo", "html" and "man". The next fetch or pull will create them again unless you configure them not to. See git-fetch(1).
  2. Delete the "test" branch even if the "master" branch (or whichever branch is currently checked out) does not have all commits from the test branch.
jschnasse
  • 8,526
  • 6
  • 32
  • 72