Apologies if this isn't really the right place, if there's already a better setting I could use...
Github's branches view for a repo is really useful when it lists by active / stale. I'd love to be able to do something like git branch -a --active
to show only the branches that GitHub considers currently active. Additionally, it would be super awesome if I could further filter the list by whether a branch was deleted, or maybe the default is to just hide deleted branches even if they are recently active. (since by default -a
includes _all_ branches that have been pushed to the repo, the output is rather unwieldy..)
Thanks for an awesome tool! 鉂わ笍
It's a nice idea, but I'm not sure if this would belong to hub. You could do it with a relatively simple script locally that iterates over the list of branches and checks the commit or authorship date of the latest tip of the branch. Also, I'm trying to focus hub more on implementing custom commands rather than extending existing git commands.
I'm not sure what you meant by deleted branches, though!
Thanks for the response @mislav I see what you mean by using an existing script and I'm probably going to get around to that a some point. :) I wasn't sure whether "active" in terms of a repo's branch on Github was something more than just by date, but as that's a list I look at regularly, it'd be nice to have the CLI tools match.
What I meant by deleted is this: if I start autocompleting branches I get a bunch of branches which have been pushed and since deleted from my local machine and from Github.
For example:
$ g pull origin michael/late [\tab\tab]
michael/late-policy-asub-viewer* michael/late-submission-with-viewer*
michael/late-policy-new-viewer michael/latepolicy*
michael/late-sub-column michael/latepolicy-viewer
michael/late-submission*
Only the 4 that I've marked with a *
are currently on Github. The rest were pushed, but deleted (and some of them never merged.) Able to only see the specific 4 branches.
I think I could restrict the configuration to only show local branches, but checking out teammates active branches is also very handy, so I like seeing remote branches (also since I'll switch computers); it would just be helpful if they could be filtered down.
I hope that makes more sense!
Using hub sync
from latest prerelease of hub should clean up your local branches that correspond to branches that were merged and deleted on GitHub.
I'll still think about --stale/--active
options.
Using hub sync from latest prerelease of hub should clean up your local branches that correspond to branches that were merged and deleted on GitHub.
That's awesome! I'll test that out.
Thanks!
After some consideration, I have decided that鈥攆or now鈥攖his is best implemented in user scripts, rather than maintained in hub core. Now that there is a new hub api
command, I will close this feature request and leave implementing this as an exercise to the reader. https://github.com/github/hub/releases/tag/v2.8.3 https://github.com/github/hub/pull/2016
Thank you for suggesting!
The api command looks very useful, thanks!
Most helpful comment
Using
hub sync
from latest prerelease of hub should clean up your local branches that correspond to branches that were merged and deleted on GitHub.I'll still think about
--stale/--active
options.