r/programming • • Feb 06 '15

Git 2.3 has been released

https://github.com/blog/1957-git-2-3-has-been-released
622 Upvotes

307 comments sorted by

View all comments

40

u/InvernessMoon Feb 06 '15

I discovered and installed Git Extensions recently. I found it to be the best client so far after using the official Git gui, TortoiseGit, and SourceTree.

0

u/[deleted] Feb 06 '15

[deleted]

0

u/[deleted] Feb 06 '15

[deleted]

25

u/bundt_chi Feb 06 '15

Is gitk not suffcient for your needs ?

8

u/dontdieych Feb 06 '15

I also love gitk. Very handy and powerful. Give it a chance.

21

u/deafbybeheading Feb 06 '15

I agree, but git log --all --graph --decorate does go a long way.

7

u/SemiNormal Feb 06 '15

git log --all --graph --decorate

This is my main complaint when using git. Why does the most basic of functions --always --require --several --switches? Aliases are just a crutch.

13

u/HeroesGrave Feb 06 '15

To be fair, turning the commit log into a graph is not basic functionality.

4

u/[deleted] Feb 06 '15

It's not, because it requires a ton of switches... If it would be something like git prettygraph it would be a basic functionality. I'm claiming chicken/egg here because a graph is more than useful.

→ More replies (2)
→ More replies (1)
→ More replies (1)

0

u/[deleted] Feb 06 '15

[deleted]

4

u/gfixler Feb 06 '15

I have these in my ~/.gitconfig:

la = log --oneline --graph --all --decorate
lb = log --oneline --graph --decorate

I also have this script on my path as git-las:

#!/bin/bash

height=$(tput lines)
height=$((height / 3))
git la -$height

I tried to do that as an alias, as a function alias, and with the help of #git and /r/git, but nothing doing. It needs to be a script, apparently. I also have a git-lass version that changes the 3 to a 6. Basically I can do git la (list all) to get a full [possibly paged] output, or git las (list all short) to fire off the script and get the same thing truncated to roughly 1/3rd of my terminal height, or git lass (list all super short) for about 1/6th the height. I git las instantly and all day long. It's not exact, because branches and merges add in a fluctuating number of extra lines between the --oneline output, but it's good enough for me. I work on a variety of monitors, from zoomed-in laptop terminals with 30 lines, to my 24" vertical work monitor with well over 100 lines, and having these things in my dotfiles means I get nice behavior everywhere. I can see existing output, along with some commit oneliner info.

I also have git-lbs and git-lbss (b for 'branch'), but basically never use any of the git lb* aliases and scripts. I seem to always want to see everything. I've used git for 2 years to great effect, and I've never used one of the UIs. I find they tie my hands. Look into fugitive (for Vim) and magit (for Emacs), too. They make git ridiculously speedy to work with, and eliminate a lot of the need for the terminal uses, especially if you have a host of mappings (Vim), as I do:

nnoremap <Leader>gs :Gstatus<CR>
nnoremap <Leader>gd :Gvdiff<CR>
nnoremap <Leader>gD :Gsdiff<CR>
nnoremap <Leader>gb :Gblame<CR>
nnoremap <Leader>gB :Git checkout -b<Space>
nnoremap <Leader>gf :Git fetch<CR>
nnoremap <Leader>gL :exe ':!cd ' . expand('%:p:h') . '; git la'<CR>
nnoremap <Leader>gl :exe ':!cd ' . expand('%:p:h') . '; git las'<CR>
nnoremap <Leader>gm :Git merge<CR>
nnoremap <Leader>gh :Silent Glog<CR>
nnoremap <Leader>gH :Silent Glog<CR>:set nofoldenable<CR>
nnoremap <Leader>gr :Gread<CR>
nnoremap <Leader>gw :Gwrite<CR>
nnoremap <Leader>gp :Git push<CR>
nnoremap <Leader>g- :Silent Git stash<CR>:e<CR>
nnoremap <Leader>g+ :Silent Git stash pop<CR>:e<CR>
nnoremap <Leader>gu :GitGutterRevertHunk<CR>
nnoremap <Leader>ct :Git ctags<CR>

That last one is based on this, which took a bit of finessing to get set up right, but has made ctags a completely automated thing for me for a long time now.

I also use git-gutter (Vim) constantly/passively to show me where my changes are, and to ]c and [c hop between them, and vim-gitv very occasionally to see the graph, but my ,gl alias (Vim, above), which prints out the output of git las for me, and ,gL, which does git la are usually more than enough to get an instant idea of what's going on with my branches and commits. The UIs are so much slower.

→ More replies (7)

3

u/ForeverAlot Feb 06 '15

I also add --oneline.

→ More replies (2)
→ More replies (2)

18

u/[deleted] Feb 06 '15

Partial file staging is why I use a gui.

40

u/haakon Feb 06 '15

git add -p is easy enough.

5

u/isarl Feb 06 '15

I use that one all the time. Every once in a while, though, I have adjacent but unrelated changes, and then I love being able to do it line-by-line with fugitive.

10

u/[deleted] Feb 06 '15

Use "e" (like "edit") when asked whether you want to stage a hunk and remove the new lines you don't want to stage and add the old lines that you don't want removed in that commit.

→ More replies (2)
→ More replies (1)

2

u/[deleted] Feb 06 '15

Which gui do you use and does it support the "e (edit)" command when partially staging?

4

u/Funnnny Feb 06 '15

I'm using magit as my git GUI. I know git add patch is nice an all. But using magit to add a hunk or edit it is so much easier.

2

u/gfixler Feb 06 '15

Well, now there are 2 of us.

→ More replies (5)

0

u/[deleted] Feb 06 '15

[deleted]

2

u/ours Feb 06 '15

I'm not crazy having to open two windows to both view the history and the current changes.

11

u/Gizmophreak Feb 06 '15

I like SourceTree on the Mac. The Windows version has some missing features and performance issues. On Windows my favorite is (not free but worth it) SmartGitHg. It's cross platform too.

4

u/unique_ptr Feb 06 '15

I love the git integration in VS2013/2015. It's made everything so damn easy.

→ More replies (4)

2

u/[deleted] Feb 06 '15

I agree, for mundane operations, GitExtensions on Windows is great! For other stuff, dropping to the command line works as well. I don't know why some folks feel like they have to use only one or the other.

→ More replies (16)