Lurker News

Comments (229) 38 threads

Show all comments

Showing thread 1 of 38

jolmg12 replies#
> are YOU tired of typing every git command directly into the terminal

I'm not. Are there many people that are? Is this not just a matter of learning to use shell keybindings effectively? That and aliases does wonders to avoid repetitive typing. Many times I type `git s` (alias for `git status -s`) out of reflex when I really meant to do `ls`.
When I forget to add `-a` to `git ci -m ...` (`ci` being `commit`) and get an error because the index is empty, I just `kF-aa` ( being ) to add it and re-execute. It's muscle memory; I do it before I even realize I did it.

frenchie143 replies#
Since `git status` is my most common command I've got it aliased to just `s`. Every time I use another machine it throws me off when the command doesn't work :)
jolmg1 reply#
I use `s` to launch a new terminal window in the same directory as the shell that called it. This way, I launch a terminal, go to a project directory, and then type s a few times to get sufficient terminals in that context.

I know it's popular, but I think I'd find it confusing for completely separate commands to relate like that. It's like cups; I was really surprised to find that the shell command `cancel` was about print jobs. I'd thought it be something more generic. I like it that git keeps all these functions related as subcommands. Makes things more readable. `git status` is not general system status, it's git's status.

terminalcommand1 reply#
You might want to check out tmux. I've changed my terminal to "st -c tmux" and every time I open a terminal window I get access to multiple frames, (nearly) infinite scrolling, window management and more.

Continue this thread — 1 reply

roryisok#
I have similar ones set up. 'Pull' and 'push'. Though some days I'm tempted to map all the old SCUMM keyboard shortcuts here.

'y' (yank) = git pull
's' (shove) = git push
'g' (give) = git commit -am x
'o' (open) = git checkout x
'p' (pick up) = git branch x
'l' (look at) = git status

akula1001#
This is why I advocate against aliases. History is universal, more powerful and needs zero configuration. ^r and few keys takes me to any command part of my daily repertoire. It really shines as the commands get more and more verbose.

^rstat -> git status
^rcomm -> git commit
^rkout -> git checkout -d foo
^redit -> git commit --amend --no-edit
^rdeco -> git commit --oneline --decorate

eljimmy1 reply#
I'm also not tired of typing git commands. It seems almost natural now. With that said, this individual spent their free time to create something using their skills which they perceived to be an improvement/optimization upon their skill-set and shared it with the world.

IMHO, that's commendable.

jolmg1 reply#
It definitely is. I didn't mean to sound dismissive of his work, but I can see how it does. My intent was rather to inform those who haven't realized, OP seemingly included, that the shell can be very efficient to work with. I can't see myself using this tool and being more productive than I already am with the shell, but I can still appreciate the effort and generosity in making it available to the world.
sushid1 reply#
I mean, to be fair, you are essentially saying you are not tired of typing git commands only because you type shorthands you've created. It feels like you're raining on his parade a bit because he didn't do the same thing you did.

I use aliases too but I also use SourceTree (gasp) for bigger commits. It's not even that I don't know how to git add -p, but clicking "add this hunk" is way easier to do.

Continue this thread — 1 reply

red75prime#
I'm not. I use GitHub Desktop for commits (with a subset of changed lines sometimes), pushing, pulling, merging, creating and deleting branches, looking at changes I did since the latest commit. I've used command line for changing executable bit in index once.
dmortin2 replies#
If you status, commit, diff often then you don't want to leave your editor, because every little things (switching to a terminal just to do git stuff) adds up in the long run.

Version control functions should be available right in your editor (e.g. magit) and you can't really beat one character hotkeys for version control stuff. It doesn't get more convenient than that.

yellowapple1 reply#
Seconding the in-editor approach. Magit is wonderful (though I often do end up heading to the command-line for certain things out of habit).
john2x1 reply#
I think it's good to keep doing some things via command line, so as not to forget how Git works "under the hood". I also keep my Git alias commands to a minimum for a similar reason.

Continue this thread — 1 reply

jolmg3 replies#
> If you status, commit, diff often then you don't want to leave your editor, because every little things (switching to a terminal just to do git stuff) adds up in the long run.

That sounds like limiting the functionality of the whole computer to what the text editor can do. That doesn't make sense. Next, you'll want to browse the web from the editor because you don't want to leave it (just because emacs does it doesn't mean it isn't absurd).
Anyway, I think it's better to configure the system so using multiple programs is as quick and effortless as possible. For your example, I use i3, a tiling window manager, and have the screen split with a terminal window on the left and my editor on the right. If I wanted to check `git status`, I just type `git s`. To go back to the editor, ``. There's really not much difference with a single character shortcut.

dmortin#
> That sounds like limiting the functionality of the whole computer to what the text editor can do.

Not really. It's about putting the most frequent features into your editor, so they can be accessed effortlessly. If you have to do something which is less frequent and the editor does not support it then you still have the terminal.
> If I wanted to check `git status`, I just type `git s`. To go back to the editor, ``. There's really not much difference with a single character shortcut.
It's efficient compared to switching to the terminal with alt-tab or something, though by single shortcut I meant that you can use it right in your editor buffer, so it's really just pressing one or two keys vs. `git s`

xorcist1 reply#
> Next, you'll want to browse the web from the editor

Well, you're clearly replying to an emacs user. He/she will not find that statement the least hyperbolic.

dmortin#
I do. I use a separate browser. There are people who want to do everything from their editors. There are people who want to do only editing in the editor.

And there are middle ground people like me who want editor integration when it makes me more efficient (like invoking frequent VC commands right from the editor), but I do mail and browsing and stuff with external tools.

stult#
That's a terrible analogy. I only use git with my IDEs and only use my IDEs with git (except one weird outside project at work where I have to use a partner company's TFS). So integration makes complete sense. Hell, that's true whether you use CLI or GUI. I use my browser for an infinite variety of different activities, only a tiny subset of which relate to my IDE.
hyperpallium1 reply#
What is `kF-aa`?
remar#
He's referring to the vi command sequence he would type to amend his command, i.e. OP has 'set -o vi' in his shellrc or 'set editing-mode vi' in his inputrc

    # x| = cursor is in insert mode, after char 'x'
    # |x| = cursor is in command mode, on char 'x'
    # () = keystrokes entered resulting in prompt on next line

    $ git ci -m ""|    ()
    $ |                     (k)    # puts shell prompt into command mode () and cycles upwards to previous command (k)
    $ git ci -m "|"|   (F-)        # from current position, reverse search (F) and stop on first occurence of '-'
    $ git ci |-|m ""   (aa)        # cursor is on '-' char, append (a) 'a', i.e. transition into insert mode by advancing cursor after current char, then insert 'a' literally
    $ git ci -a|m ""   ()      # execute command
    $ |
hv4211 replies#
If you editor has a correct git support, you never need to do git status because it will show you which files had been edited since the last commit.

Every time I hear people saying how much they prefer the git command line is because they never seriously tried to leverage the git features of their IDE.
Vs code with git lens or intellij idea have excellent git integration. Everything is one shortcut away. The git commands that are used are log into a console if you want to check.
At the end of the day both methods work, it's just a matter of preference but it is worth trying a good git UI.
Also if you ever try to teach someone git, it's not as intuitive as you think [1]. Having a consistent UX can help.
That's why there is definitely a space for this kind of git UI as presented in the article. [1]http://stevelosh.com/blog/2013/04/git-koans/

kelnage1 reply#
In my experience of using git integration features in IntelliJ, they are nice for simple tasks like quickly checking the status of a file or committing all the changes, but as soon as I need to do more complex tasks in git, I find the UIs either get in the way and slow me down or just aren’t fully featured enough to do what I need to do and I end up back on the command line. Hence why I always encourage newcomers to git to learn both if possible.

I do agree that git could certainly do with a more consistent command line interface - but I imagine that won’t even be considered until that next major version of git, if it ever arrives.

Normal_gaussian2 replies#
Git integration in IntelliJ is terrible IMO. It conflates staging and committing, and unstaging with reverting. I don't use it because it is a PITA, but what is even more annoying are the PR's from team members who do use it, which I have to send immediately back due to random files.

Continue this thread — 2 replies

jolmg3 replies#
> If you editor has a correct git support, you never need to do git status because it will show you which files had been edited since the last commit.

I prefer sticking to the Unix way. An editor is an editor. Why should it support git specifically? Git is only tangentially related to file editing, so it doesn't really make sense for an editor to know anything specifically about it.
> Every time I hear people saying how much they prefer the git command line is because they never seriously tried to leverage the git features of their IDE.
But I am! The whole OS is my IDE.
Seriously though, I've done fugitive in vim and magit in emacs. After some time of using them almost exclusively, I've decided it's better to use the shell. It's not because I haven't tried more "integrated" ways of programming, but because I find that the flexibility/power that comes with treating every feature of an IDE as a separate program in an OS environment is better.
EDIT: Added more comments.

imdsm#
> I prefer sticking to the Unix way. An editor is an editor. Why should it support git specifically?

I agree with this. Strongly.

Continue this thread — 2 more replies

Continue this thread — 9 more replies

Continue this thread — 5 more replies