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

[feature] Add support for checking out from logs #23

Closed
paul-sachs opened this issue Sep 15, 2022 · 2 comments · Fixed by #25
Closed

[feature] Add support for checking out from logs #23

paul-sachs opened this issue Sep 15, 2022 · 2 comments · Fixed by #25

Comments

@paul-sachs
Copy link
Contributor

First i'd like to say I love this thing ❤️ . It makes working with git branches so much easier.

One of the things I immediately tried was gh f -l and checkout a given entry (often to check for a bug or reset to a sane state). This would be a super useful to be able to add a command to checkout from a log entry (with ctrl+k or something... not sure yet)

That said, my bash-fu is pretty terrible. I'll try to mangle together a PR to add that but figured I'd raise this first to see if it makes sense.

@gennaro-tedesco
Copy link
Owner

Good afternoon and thank you for your kind words!

If I understand correctly, you would like a key binding (say ctrl-k in your example) to checkout the commit of the selected log entry instead of just showing the commit patch (current behaviour). If so, this was already on my roadmap and it is pretty easy to implement: only at the moment I am on holidays and will have access to a computer next week only.

If you want to have a try yourself you can essentially mimic the code here of the function gh f tags: essentially you have to tell fzf to expect a key-binding and once so, determine the action on the selected line. There is probably some sed/awk/cut to do to make sure you are acting on the commit id rather than the whole line, but if you follow the examples in the other parts of the code it should be easy enough.

This said, in 1-2 weeks I will get to this myself, so if you can survive till then you can just wait and it will be done :)

@paul-sachs
Copy link
Contributor Author

@gennaro-tedesco You are understanding correctly. I'll try to get a little time and put a PR together.

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 a pull request may close this issue.

2 participants