简体   繁体   English

为什么我仍然可以检出在远程GitLab上删除的分支

[英]Why can I still checkout a branch I deleted on remote GitLab

I have a project on GitLab, from the master I created a branch called Processing-points , not from the command line but with the web interface. 我在GitLab上有一个项目,我是从master上创建一个名为Processing-points的分支的,而不是从命令行而是通过Web界面创建的。

Then I deleted the branch Processing-points , also from the web interface. 然后,我也从Web界面中删除了分支Processing-points So everything is ok from the web interface, but on my local computer, I can still checkout the deleted branch. 因此从Web界面来看一切正常,但是在我的本地计算机上,我仍然可以签出已删除的分支。 How is that possible? 那怎么可能?

This is the suggestions I get when I ask to checkout: 这是我要求结帐时得到的建议:

ag@ag-Precision-7520:~/catkin_ws/3D_EM$ git checkout 
HEAD                                    origin/master                           origin/Processing-points-multi-thread 
master                                  origin/origin/parallelization           parallelization 
ORIG_HEAD                               origin/parallelization                  pcl_filters 
origin/HEAD                             origin/pcl_filters                      Processing-points-multi-thread

您可以使用以下方法清除对远程分支的过时引用:

git remote prune origin

You can troubleshot the issue with below aspects: 您可以通过以下方面解决问题:

  1. Use git branch -r to check if the tracking branch origin/Processing-points exist or not . 使用git branch -r 检查跟踪分支的origin/Processing-points存在 If it exists, you can use below commands update: 如果存在,则可以使用以下命令进行更新:

     git fetch -p git checkout master #if the HEAD is on local Processing-points branch git branch -D Processing-points 
  2. If the tracking branch origin/Processing-points not exist, that's caused the Processing-points branch already checked out locally before deleting the branch remotely . 如果跟踪分支的origin/Processing-points不存在,则导致在远程删除分支之前, Processing-points分支已在本地检出 And Even you deleted the remote Processing-points branch, the local branch Processing-points always exist. 并且即使删除了远程Processing-points分支,本地分支Processing-points始终存在。 And you can use git branch -D Processing-points to delete the local one. 您可以使用git branch -D Processing-points删除本地的。

I use git branch -r and saw origin/Processing-points in the list. 我使用git branch -r并在列表中看到了origin / Processing-points。 I just had to do git fetch -p to have this response : x [deleted] (none) -> origin/Processing-points-multi-thread and everything seems fine. 我只需要执行git fetch -p即可得到以下响应: x [deleted] (none) -> origin/Processing-points-multi-thread ,一切似乎都很好。 Thanks for your help! 谢谢你的帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM