News for hackers. Stuff that matters.
Re:Git 2.13 by freditup on Tuesday May 09, 2017 @10:18PM (#14305474)
Hidden in the notes at the bottom is a pretty useful improvement to 'git stash':

> 'git stash save' now accepts pathspecs. You can use this to create a stash of part of your working tree, which is handy when picking apart changes to turn into clean commits.

I believe there may be a slight error in the GitHub blog post I quoted above: from what I can tell, it's actually the 'git stash push' command that now accepts pathspecs. But either way, still a neat new feature!

Re:Git 2.13 by eslaught on Tuesday May 09, 2017 @11:37PM (#14305741)
It's worth noting that "git stash -p" (aka "git stash --patch") already exists and allows you to commit individual files or hunks within a file. Though the cost is going through an interactive interface, so some users might prefer the new "git stash push". Still, if you can't upgrade, use "git stash -p".
Re:Git 2.13 by colept on Wednesday May 10, 2017 @12:20AM (#14305896)
Patch and interactive modes are the best thing next to sliced bread. I'll start with a feature and end up refactoring something and it's difficult to organize large sets of changes without them.
Re:Git 2.13 by ooqr on Wednesday May 10, 2017 @07:20AM (#14307349)
They're definitely prereqs to upper-level git wizardry
Re:Git 2.13 by tgummerer on Wednesday May 10, 2017 @06:16AM (#14307120)
If you can upgrade you can use "git stash -p" with pathspecs as well, so you can stash some changes in a specific file without having to go through changes in other files.
Re:Git 2.13 by bruce_one on Wednesday May 10, 2017 @01:05AM (#14306031)
Ooh, this might mean some vim-fugitive beauty is on the horizon :-)

The vim-fugitive Gdiff is a really nice interface (imo) and a stash equivalent would be amazing :-)

Re:Git 2.13 by mrout on Wednesday May 10, 2017 @01:33AM (#14306116)
To me the most useful parts of fugitive, the only things that actually feel more useful than the command line equivalents, are fugitive-:Gdiff and fugitive-:Gblame.

:Gblame is particularly useful.

Re:Git 2.13 by Watabou on Wednesday May 10, 2017 @02:07AM (#14306217)
Did you try tig [1]? I prefer the command line solution to shoving complicated things and UI (which fugitive is -- I could barely remmeber all the features I had and like you, I only really ever used the :Gblame command the most) into vim. I prefer to have vim be lightweight and let other tools do their job (i.e the UNIX way).

I don't use fugitive now but I do make full use of tig. In my .vimrc I have:

    nnoremap <leader>gb :echo system("git rev-parse --abbrev-ref @ <bar> tr -d '\n'")<CR>
    nnoremap <leader>go :silent !tig<CR>:silent redraw!<CR>
    nnoremap <leader>gB :silent !tig blame % +<C-r>=expand(line('.'))<CR><CR>:silent redraw!<CR>
The above solution leaves vim purely for editing, and tig for doing the actual git presentation.

Asciinema demo of tig blame: https://asciinema.org/a/4as7ujt8cpnpyx0doyrervatl

Just like fugitive, I can travel back and forth through history. And if I hit q, I'm back in vim.

[1]: https://github.com/jonas/tig

Re:Git 2.13 by akavel on Wednesday May 10, 2017 @11:31AM (#14308921)
I also sometimes find :Gstatus useful when resolving merges/rebases/cherry-picks. Makes it easier and faster to iterate through the affected files.
Re:Git 2.13 by peff on Tuesday May 09, 2017 @11:20PM (#14305677)
Yes, you're right. The `push` command was added because of backwards compatibility issues with `save` (and essentially replaces it).
Re:Git 2.13 by masklinn on Wednesday May 10, 2017 @04:14AM (#14306651)
What are the improvements of push over save? Does it allow incrementing a stash?
Re:Git 2.13 by peff on Wednesday May 10, 2017 @04:15AM (#14306660)
It's essentially the same except for the arguments. `save` took the whole command-line to be the stash message, which was confusingly unlike the rest of Git (and needed to be addressed before pathspec support could be added).
Re:Git 2.13 by manojlds on Wednesday May 10, 2017 @06:30AM (#14307185)
Was confused with the docs. Now it makes sense, the difference between save and push.
Re:Git 2.13 by paulddraper on Tuesday May 09, 2017 @11:05PM (#14305632)
Oh awesome! Much better then commit everything else, stash, then reset