-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Added git lock rule #883
base: master
Are you sure you want to change the base?
Added git lock rule #883
Conversation
My colleague and i just ran into a funny situation while pair programming and trying to bring an out of date branch up to date with the master. We weren't quite sure what actually has changed and he said "just type git log". And so i typed "git lock". He said no... log with a "g". So i said: " no problem, i got this" and typed "fuck". But instead of "log" fuck was suggesting "lsck". So this is the intent of this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a nice story! There's always some good outcome of pair programming. If only Git would list log
as one of the most similar commands then your friend would be amazed 😄
As you probably know, there's already a git_not_command
rule. I'd recommend changing it instead, in a way to include the most common typos. Something like having a dict like this:
COMMON_TYPOS = {
'copy': ['branch'],
'list': ['branch'],
'lock': ['log'],
'switch': ['checkout'],
'update': ['fetch', 'fetch --all', 'fetch --all --tags', 'remote update'],
}
And then in get_new_command
:
# ...
matched = [replace_argument(command.script, broken_cmd, common_typo)
for common_typo in COMMON_TYPOS.get(broken_cmd, [])]
# ...
matched.extend(...) # add Git's similar commands to the end of the list
# ...
What do you think?
Hey that sounds like an even better idea. I will try to tackle this next week. Thank you :) |
Hey, @tobibechtold! Hopefully you're willing to have anoother look at this PR! |
Hello @scorphus I'm new to open source and I am interested in contributing to thefuck. Can I work on this issue? |
Go for it, @preetham1239 😊 |
No description provided.