Live data from Hacker News

Oh shit, git: Getting myself out of bad situations

ohshitgit.com

341–350 of 520 posts

Re: Oh shit, git: Getting myself out of bad situations

#341

Adopted a git GUI years ago and haven't looked back. I get looks sometimes, but I can't help but gloat when I can stage and unstage individual lines in less than a second. I think anyone who uses the CLI is either trying too hard or hasn't realized the beauty of a git GUI. Takeaways: - My commit time is usually much faster than coworkers, with higher accuracy (less frequent accidental commits, etc.) - I don't remembe…

There's a git GUI??

Seriously though, I'm somewhat new to git and any problem I come across (which are many as a new learner) are solved with command line options. I'm not even familiar with the best GUI options out there and have been trying to learn what seemed to be the "standard" way of git'ing.

Re: Oh shit, git: Getting myself out of bad situations

#342

Earlier quoted context omitted.

Within 'git add -p' when you get to the hunk that you want to edit (split down to single lines), press 'e'. This will open an editor (vim in my case) which lets you edit the diff manually. In there you can remove added lines (prefixed by '+') by removing them, and re-adding removed lines (prefixed by '-') by replacing the '-' with a space ' '.

And how is this faster/better than selecting a line with the mouse and pressing s without opening any other editor?

Do it in Vim (or emacs for those weirdos out there) and you're done before you would've even reached the mouse :)

Re: Oh shit, git: Getting myself out of bad situations

#343

Adopted a git GUI years ago and haven't looked back. I get looks sometimes, but I can't help but gloat when I can stage and unstage individual lines in less than a second. I think anyone who uses the CLI is either trying too hard or hasn't realized the beauty of a git GUI. Takeaways: - My commit time is usually much faster than coworkers, with higher accuracy (less frequent accidental commits, etc.) - I don't remembe…

I use a git GUI for staging commits, but the CLI + text editor for everything else (and no aliases). The CLI is universal--I can go to another dev's computer and get them out of rebase hell without learning their particular git GUI interface. Knowing the CLI by heart is also useful if you ever have to use git server side through SSH. I have found that the CLI fits into my workflow better than the GUI for everything except staging.

Re: Oh shit, git: Getting myself out of bad situations

#344
post #283
post #71

Earlier quoted context omitted.

If you're on a mac, I can't recommend Tower enough. It's a paid app but well worth the money. Otherwise Git Kraken is a foss offering that is also excellent.

How is atlassian's Sourcetree?

Incredibly slow. I was never annoyed so much when using a software...

Re: Oh shit, git: Getting myself out of bad situations

#347

Earlier quoted context omitted.

GitHub's GUI is the worst. It has a "sync" button. As soon as I saw that button I knew I'd have trouble using it.. what will "sync" do? Push my branches? Pull tracking branches? Will merge commits get implicitly created? Or will it just fetch? From what servers? I didn't want to risk having my local master get pushed into production just because GH wants to make things easy for me, so I just quit it and went back to…

It just pushes the current branch afaik.

So they should just call it 'push'. The word 'sync' is not in the Git terminology.

Re: Oh shit, git: Getting myself out of bad situations

#348

Earlier quoted context omitted.

You're entitled to your own opinion of course, but you underestimate the efficiency of the command line, especially when you already have one open for other development tasks. I use one or more GUIs for visualizing branches, and old branch cleanup, and yes, committing single lines from hunks that can't be split. However for everything else CLI is fairly close to optimal, including interactive adding/rebasing, and don…

> Fugitive That's interesting. I switched back from emacs to vim (neovim), and fugitive was recommended. it just looked like :commands for the normal git cli... maybe I missed something. So even though I edit in vim, I jump back to emacs for magit for bigger commits or multiple smaller commits (where I need to see diffs to be sure I capture my changes). I have desired something as useful in vim, but I didn't think th…

Yeah, fugitive seems pointless to me. Might as well just use the git cli...which I do, but when I want something quicker to navigate/visualize, magit is my go to.

Re: Oh shit, git: Getting myself out of bad situations

#349
post #192

Earlier quoted context omitted.

There are GUIs that are very close to CLI that don't try to reinvent a wheel and instead just map directly to what git does. The best one, I think, being Magit for Emacs (if you can call that a 'GUI' given you can run it in the terminal). If you get used to commit things by-line instead of by-file (which is generally highly recommended with git), and also clean up your history/squash things a lot, using git cli gets…

Sort of off-topic, but magit isn't really GUI :-) -- though it is very nice, if you're an emacs user. It's Achilles' heel is speed, though -- too damn slow. (Last time I tried it, anyway, which was a while ago.)

It's a Graphical User Interface.

I think that the distinction that makes a Commnad Line Interface is the REPL.

I consider anything with a non-linear UI that you can see a GUI.

Re: Oh shit, git: Getting myself out of bad situations

#350

Earlier quoted context omitted.

I'm planning on making a hard push for git on the team I just joined (that isn't using any VCS). This and OP are going in my bookmarks.

> I'm planning on making a hard push for git on the team I just joined You mean a force push. `git push --force` is one of my favorite commands. I've aliased `git yolo` to `git push --force --no-verify`.

>git yolo

I hope you do not work on missiles or on passenger aircrafts!

Post reply on HN