nvbn / thefuck

Magnificent app which corrects your previous console command.
MIT License
84.95k stars 3.43k forks source link

`git_branch_delete_checked_out` won't work if there is no master branch #1341

Open asportnoy opened 1 year ago

asportnoy commented 1 year ago

The code for the git_branch_delete_checked_out rule has the master branch hardcoded as what it should check out. This could be an issue if the repository does not have a master branch. You should dynamically determine the branch that should be used, maybe by using this or just getting a list of branches and choosing the first non-selected branch. master could still be a fallback if the steps fail.

Rom1deTroyes commented 1 year ago

master or main ? (no troll, just thinking :-)

asportnoy commented 1 year ago

I don't think there's a one-size-fits-all solution for a hardcoded name.