git-log--graph icon indicating copy to clipboard operation
git-log--graph copied to clipboard

deleted branches remain in graph viewer

Open rosmcmahon opened this issue 1 year ago • 3 comments

here's the scenario.

  • you have a remote branch branch1
  • locally you run git fetch --all
  • the remote branch shows up in the extension as origin/branch1
  • elsewhere the remote branch gets deleted
  • locally you run git fetch --all, but the branch remains
    • if you try the built in 'Delete (remote)' menu command you get an error as the branch doesn't exist
    • same for the 'Delete' menu command

solution is to run git branch --delete --remote origin/branch1, then a refresh on the viewer cleans it up ...until it happens again

rosmcmahon avatar May 27 '24 06:05 rosmcmahon

One could argue that this is due to part of Git's design; remote-tracking branches don't go away automatically in clones if they're deleted on the remote. git fetch --prune will clear all remote-tracking branches that correspond to deleted branches on the remote, though. That can be configured to happen with every fetch by using Git's fetch.prune option.

blm768 avatar May 30 '24 17:05 blm768

i was trying to work within the extension. i tried this:

  1. use the git fetch --all button from the extension view
  2. click on Keep window open after success so that you can edit this command
  3. add --prune to the command and save

unfortunately this is cleared the next time you click the button

rosmcmahon avatar May 31 '24 14:05 rosmcmahon

doesn't look like this is going anywhere. closing.

rosmcmahon avatar Jun 24 '24 07:06 rosmcmahon

I did not try to reproduce, but seem related to the option? image ^ I dont see any "hide-quick-branch-tips" option tho, is it a git flag?

*EDIT: SMH I saw the option dunno why it did not pop on search

dimateos avatar Nov 28 '24 13:11 dimateos

hi @rosmcmahon, the SAVE button seems to have been broken for global actions, for a long time. This is fixed now, so your strategy of adding --prune should work.

(This hasn't apparently bothered anyone else so far, but kinda makes sense: All default global actions have immediate: true set, meaning they don't expect the user to intervene and quickly close themselves again after. Modifying the args for the fetch action only works because it's a remote request and may or may not take a few seconds... very suboptimal UI, but kinda by design. I'm not very keen of revamping the entire logic just because of this very use case. One solution would be to make --prune the default for the fetch action. I'm unsure about that though, as we'd basically overwrite Git's suggested default way of doing things.)

There's an actual solution here though, I have extended the "Delete (remote)" action command a bit to hold

"args": "push \"$1\" --delete \"$2\" || git branch --delete --remote \"$2\""

and that should fix this issue for good.

(fix not yet released)

phil294 avatar Nov 29 '24 21:11 phil294

well this is the ideal solution 💯 👍

great updates to the UI visuals lately might i add!

rosmcmahon avatar Dec 02 '24 02:12 rosmcmahon