2

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.

Then I deleted the branch Processing-points, also from the web interface. So everything is ok from the web interface, but on my local computer, I can still checkout the deleted branch. 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
anothernode
  • 5,100
  • 13
  • 43
  • 62
tony497
  • 360
  • 1
  • 3
  • 15
  • 1
    It appears you either did not delete the local branch, or you never deleted the tracking branch, and `git checkout` created a new local copy. – Tim Biegeleisen Apr 12 '18 at 08:49
  • 1
    Relevant: https://stackoverflow.com/questions/26125162/difference-between-origin-branch-name-and-branch-name/26125339#26125339 – jub0bs Apr 12 '18 at 08:51
  • 1
    Indeed, @Jubobs, the answer you link to explains the situation in a much better way that what I was about to write :-). – Matthieu Moy Apr 12 '18 at 09:00
  • @MatthieuMoy Coming from you, this comment makes me very happy :) – jub0bs Apr 12 '18 at 09:03

3 Answers3

3

You can clean up outdated references to remote branches with:

git remote prune origin
anothernode
  • 5,100
  • 13
  • 43
  • 62
2

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. 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. And Even you deleted the remote Processing-points branch, the local branch Processing-pointsalways exist. And you can use git branch -D Processing-points to delete the local one.

Marina Liu
  • 36,876
  • 5
  • 61
  • 74
  • I use git branch -r and saw origin/Processing-points and then i justa add to do git fetch -p to have this response : – tony497 Apr 12 '18 at 09:38
  • Yes, you can execute `git fetch -p` to prune the deleted branch `Processing-points` from remote repo. But the local `Processing-points` branch still exists. If you also want to delete the local `Processing-points` branch, continue to execute `git branch -D Processing-points` to delete the local `Processing-points` branch. – Marina Liu Apr 12 '18 at 09:42
0

I use git branch -r and saw origin/Processing-points in the list. I just had to do git fetch -p to have this response : x [deleted] (none) -> origin/Processing-points-multi-thread and everything seems fine. Thanks for your help!

tony497
  • 360
  • 1
  • 3
  • 15