wfxr / forgit

:zzz: A utility tool powered by fzf for using git interactively.
MIT License
4.33k stars 136 forks source link

Add support for `git reflog` #155

Closed wren closed 2 years ago

wren commented 3 years ago

Feature request

I've become so dependent on forgit in my daily workflow that I honestly just get cranky when I have to do something without it. I recently had to use git reflog and found that there's no forgit command for it. Admittedly, reflog isn't a command that I need often, but when I do there's really no replacement, and I think forgit would be very useful.

Check list

Environment info

wfxr commented 3 years ago

Hi @wren, Thanks for your feedback! I'm glad that forgit can help you. I understand your needs. But reflog is indeed a command that is rarely used. If we keep adding commands like reflog, forgit will become more and more large and unwieldy. This is inconsistent with it's goal. forgit just uses fzf to make some interactive improvment to the commonly used git command. I want to keep it simple and light.

You can even extend it easily if you have some knownledge about shell and fzf. Or you can take a look at lazygit or gitui. They both are great heavyweight git tui tools. forgit is no comparable with them in terms of completeness of functions. They should be able to help you solve the similiar needs I think.

wren commented 3 years ago

@wfxr It's completely understandable if my feature request is out of scope for forgit. Thanks anyway for considering it!

cjappl commented 2 years ago

@wren Can you describe what the reflog command would do? Would it help you diff across refs? Have you check out a specific one?

To be completely honest, I didn't know about this command until this issue, and I've been using it pretty frequently now, so I'd be curious what you had in mind with this feature request

wren commented 2 years ago

@wren Can you describe what the reflog command would do?

When I first ran this, I expected it to behave like git log in forgit since the output is nearly identical. For example:

$ g log --oneline -5
  b896449 (HEAD -> main, origin/main) update whichkey for local leader in nvim
  ebee436 update nvim plugins
  a3af4b7 fix weird bug in packer for nvim
  5009299 update some lsp plugins and settings for nvim
  aa6eaa3 ls colors, encryption aliases, and hub in zsh

$ g reflog -5
  b896449 (HEAD -> main, origin/main) HEAD@{0}: pull --rebase: Fast-forward
  cb49c99 HEAD@{1}: commit (amend): move nix home-manager to stable channel
  3ed0bc7 HEAD@{2}: commit: move nix home-manager to stable
  bb6d297 HEAD@{3}: commit: add some zsh and tmux aliases and bindings
  95e0949 HEAD@{4}: reset: moving to HEAD

So, my request was to have forgit support git reflog the same way it works with git log. In this case, I'm referring to an fzf list of commits with a preview window to show the diff; pressing enter to show the full diff in less; ctrl+y to copy the commit hash; etc.

Of course, there are reflog-specific features that could be added (like parsing the HEAD@{0} and pull/commit/reset/whatever part of the output), but even just copying the current log functionality would already be very useful in my opinion.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.