Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The -v option, which the author is referring to when talking about writing commit messages in vim is much better: you get to author the commit message in the $EDITOR of your choice and you can inspect the full diff while doing so.

If you're using fzf [0] for history recall (ctrl+R) it also has the nice side-effect for not cluttering up your history.

[0] https://github.com/junegunn/fzf



I pretty much always write my commit messages in Vim and never knew about -v, this is really nice thanks for the tip. Going to set it as default with:

    git config --global commit.verbose true


It's useful, but makes you wonder why they haven't taken it one step forward and allow you to edit the diff too while you're at it.


You could if you also have the output of git diff. Then you could stage and unstage hunks or parts of them using a combination of recountdiff and git apply --cached


That sounds positively radical. Like magit taken to its conclusion.


Another option, if you're using Vim, is to use Tim Pope's Git plugin, Fugitive[0]

[0] https://github.com/tpope/vim-fugitive


And magit for the emacs folks.

They provide a conceptual framework for developer to orient and frame their actions with (sort of) right information density in the “native” $EDITOR environment.

I think VSCode has that git plugin which is very popular but I can’t remember the name - gives great git log/blame interface.



For me, personally, tig is the sweet spot. It shows me the output of "git status", I can select the files I want, and then commit them.

There is also lazygit, it's kind of similar, but different.

https://github.com/jonas/tig


What you describe sounds a lot like the :Git command of fugitive. I looked at tig and it does looks quite similar.

Another feature I really like with fugitive is :Ggrep which runs a git grep and returns the result in the quickfix list.


Oh, thanks for it.

On my computer, I usually commit using `git gui` (and CLI for everything else). Mostly because I can see the full changes I'm commiting. Now, I can do it with vim for the occasional commit from some server.


`git diff --cached` will show you the changes staged.

`git add -p` will give you a interactive way of committing partial changes.


`git commit -p` works as well.


Thanks, one of the myriad options for which I made a mental note to try after becoming proficient with git and then completely forgot




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: