`git branch

编程入门 行业动态 更新时间:2024-10-27 03:39:06
`git branch -Dr ...`与直接在refs / remotes / origin中删除文件有什么区别吗?(Is there any difference between `git branch -Dr …` vs. deleting the file directly in refs/remotes/origin?)

删除远程分支是否有任何真正的区别

git branch -Dr origin/<branch name>

与删除

.git/refs/remotes/origin/<branch name>

直?

据我所知,没有,但是最好使用预期的git CLI进行任何git操作。

Is there any real difference between deleting a remote branch with

git branch -Dr origin/<branch name>

vs. deleting

.git/refs/remotes/origin/<branch name>

directly?

As far as I can tell, there isn't, but it's preferred to do any git operations with the intended git CLI.

最满意答案

是:

如果已将分支添加到.git/packed-refs ,则删除已解压缩的ref文件(如果存在 - 如果远程跟踪分支自所述打包以来已更新)将仅恢复打包的ref,但删除分支使用前端命令将删除这两个副本。

此外,前端命令删除分支的reflog(如果存在所述reflog)。 这既好(防止以后出现问题)又坏(如果你改变主意,你就无法获得reflog)。

Yes:

If the branch has been added to .git/packed-refs, deleting the unpacked ref file (if it exists—it will if the remote-tracking branch has been updated since said packing) will simply restore the packed ref, but deleting the branch with the front end command will delete both copies.

Also, the front end command deletes the reflog for the branch (if said reflog exists). This is both good (prevents problems later) and bad (you can't get the reflog back if you change your mind).

更多推荐

本文发布于:2023-07-31 21:51:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1349006.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:git   branch

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!