Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Git Remote Prune Origin #556

Open
LazerFX opened this issue Nov 23, 2018 · 13 comments

Comments

@LazerFX
Copy link

commented Nov 23, 2018

It would be nice if you could right-click on the origin after creating/removing branches and do a git remote prune origin, to remove from the local cache all the remote branches that no longer exist.

Our workflow is:

  • Create feature branch
  • Complete (small) task of work
  • Pull into release branch, with auto-destroy of feature branch on complete

This means that we tend to have lots of task-related branches that can build up very quickly. At present, there's no way to remove these easily - we don't want to run the risk of deleting any branches that should be there, so a cleanup of local tends to wait a while as these build up. Finding the git remote origin prune command helped out quite a bit, but it's still a command-prompt step. Integrating this into GitLens would go a long way to not having to recall arcane command-line commands!

@LazerFX LazerFX changed the title Feature Request: Git Remote Origin Prune Feature Request: Git Remote Prune Origin Nov 27, 2018
@LazerFX

This comment has been minimized.

Copy link
Author

commented Nov 27, 2018

It would be nice if there was also a way to remove the local tracking branches as well; that's a much more manual process, but would be a feel-good improvement,

@eamodio eamodio added this to the Backlog milestone Dec 3, 2018
@mika76

This comment has been minimized.

Copy link

commented Feb 4, 2019

Hell yeah - only thing missing as far as I can see

@DrYSG

This comment has been minimized.

Copy link

commented Feb 22, 2019

Right now, you have an option to right-click on a branch and delete local via the ternminal.

which does something like:

git branch -d Sprint-1.4

Could this not also be simple done, but instead do a pull and prune?

git pull --prune

?

@julian-poidevin

This comment has been minimized.

Copy link

commented Jul 24, 2019

👍 I'd like such a feature. It can be done as suggested here by using this command line :

git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -D

A integrated Delete local branches not on master feature would be great though.

@eamodio

This comment has been minimized.

Copy link
Owner

commented Aug 6, 2019

@zaboyle If you are looking for another command to add -- this one is quite similar to the one you just added 😉

@zaboyle

This comment has been minimized.

Copy link
Contributor

commented Aug 7, 2019

@eamodio For sure, I'll give it a shot!

@zaboyle zaboyle referenced this issue Aug 7, 2019
8 of 8 tasks complete
@julian-poidevin

This comment has been minimized.

Copy link

commented Aug 7, 2019

@zaboyle Thanks for looking into this. @LazerFX I was wondering, does your feature request includes pruning local tracking branches that do not exist on remote anymore ? That was what I was interested about. Thanks.

@LazerFX

This comment has been minimized.

Copy link
Author

commented Aug 7, 2019

That's what the command does, yes... It's really useful if (like me) you end up making lots of small branches for small features, and then roll them up at the end of a week or two...

@zaboyle

This comment has been minimized.

Copy link
Contributor

commented Aug 7, 2019

I agree, that is a useful tool. That just brings up the question of whether or not it should be separate from just a 'prune', or if the 'prune' should also remove these local branches. @eamodio what's your take?

@DrYSG

This comment has been minimized.

Copy link

commented Aug 7, 2019

well my take is I want to be able to prune the local dead branches, and ideally be able to do that remotely. In the best case I would have a list of each and be able to interactively choose the ones I want to keep.

@eamodio

This comment has been minimized.

Copy link
Owner

commented Aug 7, 2019

@zaboyle I definitely don't want to mix pruning with deleting local branches -- prune is a known git option and I wouldn't want to confuse that with unexpected behaviors, especially a destructive one.

I would suggest keeping prune as-is and then opening a new issue for deleting (in bulk) branches. IMO, the best place for something like that is via the new Git Commands command by adding a new branch and then remove option.

It could also eventually be added to the tree views once multi-select support that is coming soon in vscode ships.

@zaboyle

This comment has been minimized.

Copy link
Contributor

commented Aug 7, 2019

@eamodio Sounds good! When I get the chance, I'll mark the PR for the prune feature as ready for review, and open a new issue for removing the "dead" local branches.

@zaboyle

This comment has been minimized.

Copy link
Contributor

commented Aug 8, 2019

Just made an issue for this over at #817 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.