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

Suggest git checkout -b #754

Merged
merged 2 commits into from Jan 1, 2018
Merged

Suggest git checkout -b #754

merged 2 commits into from Jan 1, 2018

Conversation

djh82
Copy link
Contributor

@djh82 djh82 commented Jan 1, 2018

This should fix #632.

While playing with this fix, it wasn't obvious to me why git_checkout.py is suggesting changes for git commit; the suggestions don't seem sensible.

djh82 and others added 2 commits January 1, 2018 15:54
This lets it work even if there's extra spaces in the command, e.g.

    git  checkout unknown
@josephfrazier josephfrazier merged commit 83cf97d into nvbn:master Jan 1, 2018
@josephfrazier
Copy link
Collaborator

Thanks @davidhart82! I just made a slight tweak (and probably should do the same for other rules).

@djh82
Copy link
Contributor Author

djh82 commented Jan 2, 2018

Hmm...yeah, that whole thing doesn't seem very robust. What if I wanted git - -git_dir=xxx checkout branch. I think a lot of the suggestions don't cater for this when using positional references in script_parts.

@josephfrazier
Copy link
Collaborator

Yeah, I guess it would be better to filter out the script_parts that start with - before checking the one at a particular position. I'm not sure if this has been an issue in practice, but if you'd like to implement it, feel free to submit a PR.

riley-martine pushed a commit to riley-martine/thefuck that referenced this pull request Dec 7, 2023
This fixes nvbn#632

This uses `script_parts` instead of `script.startswith`
to let it work even if there's extra spaces in the command, e.g.

    git  checkout unknown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

git checkout new branch suggestion improvement
2 participants