Live data from Hacker News

Oh shit, git: Getting myself out of bad situations

ohshitgit.com

371–380 of 520 posts

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

#371
post #364

Earlier quoted context omitted.

Yep. That is the important tip, right here. $ pushd .. $ cp -a my-project my-project-before-I-did-git-surgery $ popd Then relax. This is extremely important before playing with nasty Git surgical tools such as huge rebases. Borked it up? $ pushd .. $ rm -rf my-project $ cp -a my-project-before-I-did-git-surgery my-project $ popd Undo is a great thing, and it's also important to triple check the entire state of the re…

This is so wrong. :) With git you exactly do not have to backup your local workspace, because it already is backed up in git. If it is committed, it is safe. You can go back to it. If you messed up your branch, just reset it to something that was good. No need to do manual backups.

Sure it's wrong if you know what you're doing. But that's not who the blog post is for.

Sometimes it's okay to take liberties with good practices - especially when learning, or when the world is on fire and a push needs to happen now.

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

#372
post #123

Earlier quoted context omitted.

I use the git CLI. I do it for one reason. I know exactly what i'm doing on it. I have nothing to prove to anyone, I'm not trying to impress anyone with my "hacker" skillz. When I've tried GUI's, I'm not 100% sure what's going on under the covers. Sometimes they try to obfuscate things. While I'm probably not the worlds most advanced user, I know enough to know what I want to do, and how to do it. The CLI let's me do…

You might want to try Sourcetree if you haven't already. I felt the same way about Git GUIs for a long time, but Sourcetree actually does a good job of getting out of my way, and has a very nice commit history tree viewer to boot.

I dislike SourceTree precisely because it uses git terminology. Git’s terminology is bad enough, but it completely breaks down for me in a GUI, because I expect that GUI’s conventions there. For example, on the Mac (as in English, I think), a command named “Remove” removes an item from a containing item. “Delete” also destroys the item. SourceTree, however, uses “Remove” for “git rm” because Unix thinks “remove” destroys items.

To make matters worse, what in a Mac GUI would be called “Revert” or “Discard Changes” is called “Discard”, something that, to me, feels more destructive than it is.

End effect? We have “Discard” being less destructive than “Remove”, while, to me, it feels the other way around.

(I may remember this wrong, but if I do, I think that’s a sign of the problem of not following platform conventions in your software)

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

#373

Earlier quoted context omitted.

If by "designed" you mean "picking a content-addressable DAG as an underlying data structure", then yes, it is really beautiful. If you mean "provide a sane level of abstraction over said data structure", then hell no!

I think git provides a sane level of abstraction. I don't think it provides the most consistent UI or helpful help, though. Once you move away from "learning git commands" to "learning how git works" and kind of figuring out which parts the commands refer to has helped also. That's still terrible though.

http://stevelosh.com/blog/2013/04/git-koans/

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

#374
Geez, using `git add .` is the worst thing you can do. Never use this. Tutorials: stop suggesting this. It's just a recipe to getting yourself into a mess (plus, you should never work so blindly!).

Add individual files, and, if possible, use `git add -p`, which lets you review each chunk before adding it to the index. Otherwise, diff and add individual files.

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

#375

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…

Which git GUI are you using?

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

#376

Earlier quoted context omitted.

You might want to try Sourcetree if you haven't already. I felt the same way about Git GUIs for a long time, but Sourcetree actually does a good job of getting out of my way, and has a very nice commit history tree viewer to boot.

Actually I find Sourcetree one of the worst git GUIs out there. There are just so many bugs and kinks and glitches in it that I avoid it if possible. I do like the Gitx-dev fork by Rowanj [1]. Clean and simple. Unfortunately just for Mac OS though. [1] https://rowanj.github.io/gitx/

I haven't encountered any of these bugs. But I do use it only rarely, the CLI is where I live most of the time. Good to know about alternatives.

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

#377
post #123

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 the git CLI. I do it for one reason. I know exactly what i'm doing on it. I have nothing to prove to anyone, I'm not trying to impress anyone with my "hacker" skillz. When I've tried GUI's, I'm not 100% sure what's going on under the covers. Sometimes they try to obfuscate things. While I'm probably not the worlds most advanced user, I know enough to know what I want to do, and how to do it. The CLI let's me do…

Same here. Regrettably, if you UNDERSTAND git, a GUI won't work for you. If you're interested in understanding it, it won't work for you either.

A GUI works fine if you want to get things done. If you like to know what goes on under the hood, it's just confuse you.

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

#379
post #273
post #244

Earlier quoted context omitted.

Doesn't really make the interface any less crap; though I've yet to see a GUI that didn't shell out to the command-line interface (which almost always makes them very unreliable).

I believe GitUp directly links to git library and doesn't use a command line shell.

Yes, GitUp actually ships its own git library.
Post reply on HN