@mlang raised a good point at the end of his blog post about not being able to delete a fork.
What are your thoughts about this command delete
? I see it useful in cases where I make a quick pull-request and then don't want to clutter my repos so I want to delete it right away. We could replicate the web interface by asking the user to type the name of the repo to confirm deletion. (We can also go a step further and only delete the repository if it's a fork?)
It could be useful, for instance to undo a create
command. But on the other hand I also don't think it would be used much, so I'm not sure if we would maintain it. Also, deleting forks after putting up a pull request is dangerous since I don't think someone can merge that PR if you deleted the fork where it was coming from.
I'd rather create a plugin arhitecture to enable adding such commands to your environment without adding them to hub core.
:+1: to a plugin architecture!!
(I _think_ you can still merge a PR if the fork is deleted since those PR's are stashed in the main repo but I could be wrong :satisfied:)
I could confirm PRs could be merged if the branch on the fork is deleted. Not sure if the whole repo is deleted.
Ivan Tse [email protected] writes:
@mlang raised a good point at the end of his blog post about not able to delete a fork.
What are your thoughts about this command
delete
? I see it useful in cases where I make a quick pull-request and then don't want to clutter my repos so I want to delete it right away. We could replicate the web interface by asking the user to type the name of the repo to confirm deletion.
I have implemented exactly that in my fork of hub.
(We can also go a step further and only delete the repository if it's
a fork?)
Confirmation is important, restricting to fork deletion will create yet
another accessibility corner case. How am I supposed to delete my own
projects I dont need anymore now? :-)
I can confirm that deleting a fork does not cancel or break a Pull Request. Here is an example.
Any progress on this feature request?
The patch was simple, and IIRC, I even submitted a PR.
However, the maintainers thought that adding this command would somehow
go over the edge of what hub is supposed to be able to do. I found that
very strange, but moved on.
@mlang I wasn't aware of a PR to implement this submitted by you; sorry if I missed it.
There's not progress on this feature request because it's not a burning issue for us right now. The next release of hub will focus on improving release
, issue
, pull-request
and browse
commands. We'll be careful about adding new commands in the future and will only consider ones that we predict to be having high usage.
@mislav I'll throw in my vote for a delete
command. When you make a lot of small contributions to a lot of repositories, your GH profile quickly becomes cluttered with forks you only really needed for a single PR. Manually going through and deleting each of these stale forks is tedious work.
+1, it's gonna be a useful command to have.
+1. Delete each repository use web-interface take a lot of time.
@mislav , status?
Thanks.
+1. Delete each repository use web-interface take a lot of time.
hub
brings you so much comfort that you can't live with such daunting tasks like deleting repos via the webapp anymore.
Based on @mislav's responds, I don't think the feature is making it into a release. There's even a closed pull-request implemented this exact feature. See #278.
While I completely understand maintainers' concerns, I need to do something about it. Every single time that I do a git pull-request
and it gets accepted I need to open up the browser, type the address + /settings, scroll down, hit the button, type or paste the name, hit the button. It's so hard! Or every time that I do a git fork
and it squeaks that the repo already exists; same story.
So, I was using @mlang's fork for a while, but as of writing this, it's 1,541 commits behind the upstream. Seems that this or any other fork is not a permanent solution to this.
As a workaround, I wrote a git
wrapper function to handle repository deletion. It requires gcli
gem which is easily installable with a gem install github_cli
. Here it is for anyone else that feels the need.
git() {
if [ "$1" != "delete" ]; then
hub $@
return
fi
if [ -z "$2" ]; then
echo "No repo name given."
return 1
fi
if ! command -v gcli &> /dev/null; then
echo "gcli is not available. run: gem install github_cli"
return 1
fi
GCLI_USER=$(gcli config user.login)
if [ -z "$GCLI_USER" ]; then
echo "gcli's user.login config is not set. see: gcli help config"
return 1
fi
gcli repo delete $GCLI_USER $2
}
To recap:
gcli
gem~/.githubrc
gcli repo list
alias git=hub
from your shell file and use this function insteadgit delete your-repo-name
to delete your repo. It's done if you get a Response Status: 204.You can make it work for orgs with a small tweak, right?
Oh, I'm free again.
@sepehr Thanks for sharing more context and your workaround! 👍
@sepehr ,
use this function instead
May you say more details, how we can do it?
Remove the alias git=hub from your shell file
Can we do without the removal? I often use git=hub
alias.
Thanks.
I often use
git=hub
alias.
@Kristinita, The function already acts as a hub alias. So you won't need setting the alias anymore, it proxies any command to hub
unless it's delete
.
Sepehr Lajevardi notifications@github.com writes:
So, I was using @mlang's fork for a while, but as of writing this,
it's 1,541 commits behind the upstream. Seems that this or any other
fork is not a permanent solution to this.
I haven't been keeping that fork up-to-date because I luckily didn't
need any new version of hub
since. I would actually very much prefer
to not have to do the extra work and have this simple and very useful
feature merged. In my case, it is about Accessibility.
My FLOSS workflow is console only, and I use Lynx to browse the web when
necessary. It is actually impossible to do a repo delete with Lynx
on github because of some modern web pain. So for me, when I want to
delete a repo without my modified version of hub
, I actually need to
fetch my speech-enabled Windows laptop and do the repo delete with that,
which is such a PITA that it is not even funny to explain.
When I had my fair share of grudges with the too-modern webdesign of
github.com for Accessibility resons, I was actually thrilled to find
hub
. It was (and is) the one-stop solution for all my GitHub needs.
Motivated and positively charged, I wrote the delete patch and submitted
this PR because that was really the only thing I was missing from
hub
at that time. I have actually been quited saddened by the overall reaction
from upstream. This isn't really hard, without any active Ruby
knowledge and fresh to the GitHub API, it took me probably half an hour
to do. And it is useful, and for some users (like me) almost the only
option. We could add a special prompt, like
Enter "I really want to delete mlang/hub" to confirm:
if you insist on patronizing developers. However, I don't really think
that would be necessary.
That said, if hub
ever breaks for me, I will try to update that fork,
or check out gitlab.
--
CYa,
⡍⠁⠗⠊⠕ | Blog: https://blind.guru/ GitHub: https://github.com/mlang/
.''. | Twitter: @blindbird23 FaceBook: disyled
: :' : | SoundCloud: <soundcloud.com/mario-lang>
. ' | YouTube: <youtube.com/user/mlang23>
-
Motivated and positively charged, I wrote the delete patch and submitted this PR because that was really the only thing I was missing from
hub
at that time. I have actually been quited saddened by the overall reaction from upstream.
I'm sorry that we failed you, @mlang. Since I'm the one choosing the feature set for hub, I'm taking full responsibility for letting your contribution fall through the cracks. Yes, new commands might not be hard to develop, and I fully understand that you were baffled that something relatively simple didn't get accepted immediately. But I would like that you keep in mind that hub was at a big transition at the time, rewriting all existing code from Ruby to Go, and that we were struggling with maintenance and fixing all the bugs in the existing features too much to consider adding new features.
The next releases of hub will focus on making more operations possible that are already exposed through the API but not yet through hub. Until then, there is no reason why you should stop using your fork if it's working out for you.
Thank you for the feedback about where are the weak points for Accessibility on GitHub right now and what we can do to make it better.
@sepehr, I install gcli
gem → I set my username/password and token → gcli repo list
→ I get long output about my repositories. May you tell more details, what I need to make further? How use your function?
Thanks.
@Kristinita, So it's working. Just swap the alias with the function, open up a new terminal window and you can git delete repo-name
your repo. By swapping, I mean that you need to copy and paste that function into your .bashrc
or .zshrc
file or whatever it is and delete the alias.
And please be careful. Frankly, if you're having trouble setting this up, you probably don't want such a dangerous helper at your disposal.
@sepehr
By swapping, I mean that you need to copy and paste that function into your .bashrc or .zshrc file or whatever it is and delete the alias.
I'm sorry, I Windows user, I can not use Bash or Zsh. Is it any method for Windows?
And please be careful. Frankly, if you're having trouble setting this up, you probably don't want such a dangerous helper at your disposal.
I'm sorry, I never paste functions use git. I only work in terminal. Where I can read more details about it?
Thanks.
@Kristinita, I'm not a Windows user and have no idea how you can setup this helper there. Sorry :(
@mislav
But on the other hand I also don't think it would be used much, so I'm not sure if we would maintain it.
This is the single reason why I want to use hub
in the first place. Other than creating remote repositories of course. Just showing my support in that it would DEFINITELY be used. Thanks!
EDIT: @sepehr This is a fantastic work around! Thank you for sharing! I probably spent way too much time on this than I should have, but I tweaked it for my needs:
(caveat: repository namespace is now required, i.e. git delete $namespace $repository
instead of git delete $repository
)
Any updates on when hub delete
is coming? I'm running through the 1) fork, 2) PR, 3) manually delete the repository loop every time I update a Homebrew cask version...
Would also love to know if it would be possible to add a command for this? This would be a huge time savour as deleting each fork/repo from web interface takes too long of a time. 😞
I agree 100% with the use case: "what can be created and edited, should also be deleteable". :-)
So I adapted the go-code in a local branch, see:
https://github.com/andreasbaumann/hub/tree/delete_repository
+1.. this would be a very helpful feature.
Because people can use this mistakenly in a script, and delete whole repos.. I can see a reason not to include it here..
It still would be very helpful. Instead of not including it at all, perhaps, there could be a check such that the user has to manually type in their password, or a arbitrary number, so that such mistakes dont happen.
See my branch: it asks for the name of the repo and asks for confirmation.
I need it in scripts, so I have an environment variable HUB_UNSAFE_DELETE which
can be set when needed.
@andreasbaumann , maybe you make pull request?
Thanks.
Most helpful comment
hub
brings you so much comfort that you can't live with such daunting tasks like deleting repos via the webapp anymore.Based on @mislav's responds, I don't think the feature is making it into a release. There's even a closed pull-request implemented this exact feature. See #278.
While I completely understand maintainers' concerns, I need to do something about it. Every single time that I do a
git pull-request
and it gets accepted I need to open up the browser, type the address + /settings, scroll down, hit the button, type or paste the name, hit the button. It's so hard! Or every time that I do agit fork
and it squeaks that the repo already exists; same story.So, I was using @mlang's fork for a while, but as of writing this, it's 1,541 commits behind the upstream. Seems that this or any other fork is not a permanent solution to this.
As a workaround, I wrote a
git
wrapper function to handle repository deletion. It requiresgcli
gem which is easily installable with agem install github_cli
. Here it is for anyone else that feels the need.To recap:
gcli
gem~/.githubrc
gcli repo list
alias git=hub
from your shell file and use this function insteadgit delete your-repo-name
to delete your repo. It's done if you get a Response Status: 204.You can make it work for orgs with a small tweak, right?
Oh, I'm free again.