1

Check out this screenshot...I just queried the branches and it shows that branch 'different-oil' is in the list of branches...then when I tried "del, rm, or checkout" the branch, it says the branch did not match...here's the screenshot:
enter image description here
What happened is that I deleted the branch from github once I merged the new master. Then in turn, I pulled the new master from github and merged. All is the same. How can I delete this branch that git is saying doesn't exist? I also relogged in:
enter image description here
Any Ideas...?

2
  • above you can see that i am in master. del branch doesn't work, and removing didn't say anything, and it's still there. Commented Aug 16, 2016 at 19:16
  • 1
    It appears you have some bash errors. del is not a bash command. (This indicates it is not a missing branch problem, but you are missing the command name) You need to prefix your git command with git try git branch --help or google "git remove branch" Commented Aug 16, 2016 at 19:21

3 Answers 3

3

As Thomas pointed out in the comments, del is not a valid bash command and also not a commad related to git, which is the main error.

To delete a local branch you can use git branch -d different-oil.

To delete a remote branch you can use git push origin --delete different-oil or git push origin :different_oil.

However, as you also tagged github, you can easily delete the branch in the webinterface.

Related question: How do I delete a Git branch both locally and remotely?

Further information: https://git-scm.com/book/en/v2/Git-Branching-Branch-Management

Sign up to request clarification or add additional context in comments.

2 Comments

you can also use git push origin --delete different-oil to delete a branch remotely
Thanks @ThomasF, I edited my answer to include your comment.
1

Basically you are running shell commands instead of git commands. You should prefix git-related commands with git. Take a look at git --help and git branch --help.

To delete that branch you have to run git branch -d different-oil.

1 Comment

ty, you're right. I was not typing git...also, i did find my error and fix the issue in the merge process, but no explanation on "why did git not recognize it"
0

Here's my answer...after reading another related post about deleting local branches, using the git branch -d, this command did let me know that on the local machine the merge was incomplete. This doesn't explain why it was telling me that the branch could not be found, but once I merged, then, as you can see below, the branch was deletable with the "git branch -d" command. Thanks to those who assisted.
enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.