最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

git - how to delete "originoriginrelease_251q"? - Stack Overflow

programmeradmin1浏览0评论

I'm a git beginner.

I tried making a branch while studying git, but I think I did something wrong.

So the repository was created as below. (Sorry, I don't remember the process well)

HEAD                         origin/HEAD                  origin/origin/release_251q 
master                       origin/master                origin/release_251q 

So, I want to delete "origin/origin/release_251q"

How to delete it ??

I'm a git beginner.

I tried making a branch while studying git, but I think I did something wrong.

So the repository was created as below. (Sorry, I don't remember the process well)

HEAD                         origin/HEAD                  origin/origin/release_251q 
master                       origin/master                origin/release_251q 

So, I want to delete "origin/origin/release_251q"

How to delete it ??

Share Improve this question edited Jan 19 at 12:22 dani-vta 6,8307 gold badges49 silver badges65 bronze badges asked Jan 19 at 11:10 kay.kimkay.kim 11 0
Add a comment  | 

2 Answers 2

Reset to default 2

Topic branches can be deleted with the command git branch supplied with the -d option and the branch name.

git branch -d <branch_name>

However, a branch can be deleted only if it's not currently checked out and if its commits are reachable from the current branch. In case the second condition is not satisfied, you can force the deletion by using the -D option instead of -d.

git branch -D <branch_name>

Instead, tracking branches can be deleted by supplying the -r option along with -d, the remote's name, and the tracking branch to delete.

git branch -d -r <remote>/<branch_name>

To assess whether origin/origin/release_251q is a topic branch or a tracking branch, run git branch -vv and check if it appears in the list on the left (as a topic branch) or on the right between square brackets (as a tracking branch). For example, here master, develop, and release/6.2.12 are topic branches, while origin/master, origin/develop, and origin/release/6.2.12 are their corresponding tracking branches.

git branch -vv
  develop              cf73514 [origin/develop] my commit message
  master               2ebf2ef [origin/master] another commit message
* release/6.2.12       e8b026f [origin/release/6.2.12] a commit message
  ...

You didn't write which command produced the output you paste in your question, I will assume this is the output of git branch -a, that origin/release_251q is the local branch with the problematic name, and origin/origin/release_251q is an indication of the remote branch.

To rule out any ambiguity, please run git for-each-ref and paste the output of that command.


To delete the remote branch with the problematic name, run:

git push origin -d origin/release_251q

Locally, to give the correct name to your branch, run:

git branch -m origin/release_251q release_251q

If you want to create a remote branch with the name `release_251q, run:

git push origin release_251q
发布评论

评论列表(0)

  1. 暂无评论