4 ms·
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 $E
by tams 6y ago
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 https://github.com/junegunn/fzf
- roryrjb 6y agoI 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
- da-x 6y agoIt'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.
- tomjakubowski 6y agoThat sounds positively radical. Like magit taken to its conclusion.
- u801e 6y agoYou 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
- Agentlien 6y agoAnother option, if you're using Vim, is to use Tim Pope's Git plugin, Fugitive[0] [0] https://github.com/tpope/vim-fugitive https://github.com/tpope/vim-fugitive
- wadkar 6y agoAnd 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.
- sanketdasgupta 6y agoGitLens! https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens https://marketplace.visualstudio.com/items?itemName=eamodio....
- hibbelig 6y agoFor 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 https://github.com/jonas/tig
- Agentlien 6y agoWhat 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.
- krab 6y agoOh, 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.
- sadfklsjlkjwt 6y ago`git diff --cached` will show you the changes staged. `git add -p` will give you a interactive way of committing partial changes.
- kohtatsu 6y ago`git commit -p` works as well.
- g-b-r 6y agoThanks, one of the myriad options for which I made a mental note to try after becoming proficient with git and then completely forgot