-
-
Notifications
You must be signed in to change notification settings - Fork 797
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
feat: add git reset action for git commits picker #999
feat: add git reset action for git commits picker #999
Conversation
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.
LGTM can we get some docs for the key mappings here
telescope.nvim/lua/telescope/builtin/init.lua
Lines 143 to 148 in 1386979
--- Lists commits for current directory with diff preview | |
--- - Default keymaps: | |
--- - `<cr>`: checks out the currently selected commit | |
---@param opts table: options to pass to the picker | |
---@field cwd string: specify the path of the repo | |
builtin.git_commits = require('telescope.builtin.git').commits |
Similar to git_branches
Also i am interested, how do you wanna do configuring of |
Absolutely! Pushed.
That's a good idea for it. I was still thinking about it. 😄 Thank you @Conni2461! |
I don't see any reason not to do something like The user can just map whatever one they want to override |
Sweet. I like it. I'll update this accordingly. |
Updated per the above comment from @tjdevries. This PR now has these actions (which share implementation) available in the
Keymaps:
Docs have been updated to reflect these updates. 😃 |
I'm not sure what @tjdevries and @Conni2461 would prefer, but to me it seems like a better user experience to just have This then doesn't overcomplicate things for new users, but allows "power users" to easily configure things how they want. Although it is then very important to have it be easily discoverable in the documentation that this is something that they can configure. |
Thanks for the feedback @l-kershaw! Either way works for me. As you mentioned or having all modes mapped.
For now, to be "easily discoverable", I've added documentation for the mappings to the Git Pickers → |
LGTM, Thanks @joelpalmer. |
Thank you @tami5! |
Adding a git reset action and making it available in the
git_commits
picker.This PR:
git_reset
actiongit_commits
picker<c-r>
to call the action in either normal or insert modeLike similar actions, the
git_reset
action has a confirmation along with handling of the error and success cases and their messages. The default for git reset is --mixed. That behavior is continued here. If this PR is accepted, I'd like to follow-up with --soft and --hard options in a future PR. I personally have my local version hardcoded to--hard
. But, that would probably surprise and upset many users if it were the default. Git's default is safe and friendly. 😄The reason for adding the new action to the
git_commits
picker is because it's Telescope'sgit log
picker. It is convenient, intuitive and awesome toreset
to the selected commit. I've been using it locally for a while and it saves me from having to copy/paste the SHA or count backwards fromHEAD
. Who has time for all that? Telescope to the rescue as usual. 🔭