gpt4 book ai didi

Git:为什么删除后还能切换到分支?

转载 作者:行者123 更新时间:2023-12-02 15:48:44 24 4
gpt4 key购买 nike

刚刚发现,删除后仍然可以切换回分支。这是我的一个特殊示例:

git switch master
git branch -d AB-10/add_flights
...
// deleting also the remote branch on GitHub

git switch AB-10/add_flights

// I see the branch again

怎么会?

最佳答案

原因很简单:您只在本地删除了它。

手册页报告:

Optionally a new branch could be created with either -c, -C, automatically from a remote branch of same name (see --guess), or detach the working tree from any branch with
--detach, along with switching.

由于远程还存在,GIT可以重新切换到它。

通过 git push --delete origin <branch-name> 删除它然后再次尝试检查它...

关于Git:为什么删除后还能切换到分支?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73275144/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com