V
V
Vlad2020-12-22 22:40:34
git
Vlad, 2020-12-22 22:40:34

How to completely get rid of an annoying branch?

Started learning GIT. I deleted the new3 branch with a commit, and now after the git branch command, -d still appears at the bottom:

C:\path\to\myproject>git branch
* master
  –d


What does -d mean after git branch command? We begin to understand and issue commands:
C:\path\to\myproject>git checkout -d
HEAD is now at a96b167 new3 commit

C:\path\to\myproject>git branch
* (HEAD detached at a96b167)
  master
  –d

C:\path\to\myproject>git branch new3

C:\path\to\myproject>git branch
* (HEAD detached at a96b167)
  master
  new3
  –d


I don’t remember how it happened, but when I now try to permanently delete this branch using the git branch -D new3 command
, we again get:
C:\path\to\myproject>git branch
* master
  –d

and the ability to restore the new3 branch we don’t need.
Created other branches, committed to them, then switched to master and deleted these branches with -d, got a known message, then deleted completely with -D and they disappeared completely

How to completely get rid of a branch and get only one master when viewing branches?

PS: I work through VS Code

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vasily Bannikov, 2020-12-22
@vabka

Googling easily.
https://koukia.ca/delete-a-local-and-a-remote-git-...

L
Lynn "Coffee Man", 2020-12-22
@Lynn

You managed to create a branch called "-d"
Try to delete it with the
git branch -D -- -d
UPD command: after careful study, I see that you do not have a hyphen there, but en-dash.
Try copying and running this command
git branch -D –d
notice that the characters before D and d are different.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question