Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Git might not be hard, it might be easy, but for someone who has not spent enough time trying to understand it, it gives options to royally F up if you don't know what you're doing. So I make it a point to never use any command other than cherry-pick. Everything else I use GitHub desktop for. Its a simple ui that only lets you do the bare minimum of git actions thats less F up prone.

Thats my personal story. The other problem I see is a large number of engineers who say git is not hard, it's very straightforward and they understand it very well, but actually they don't. And every once in a while they royally F up the entire repo and cause issues in deployment because of that. So git's main problem from my perspective is that it's an extremely advanced, unforgiving tool that gives a false sense of expertise to many mediocre programmers.



> Git might not be hard, it might be easy, but for someone who has not spent enough time trying to understand it, it gives options to royally F up if you don't know what you're doing.

You've just described nearly every tool, show enough carelessness with a hammer and you'll certainly fuck something up.

> So I make it a point to never use any command other than cherry-pick. Everything else I use GitHub desktop for. Its a simple ui that only lets you do the bare minimum of git actions thats less F up prone.

Yes, when you handicap yourself, limiting to a subset of available features. You'll usually have fewer ways to screw up. But I hope that's not advice you give out to others. That's exactly the mentality I'm trying to encourage people to avoid. "I don't understand it, so instead of trying to learn more about it, I'll just limit my self to a trivial subset of the actual options." That's not how you get good at anything.

> Thats my personal story. The other problem I see is a large number of engineers who say git is not hard, it's very straightforward and they understand it very well, but actually they don't. And every once in a while they royally F up the entire repo and cause issues in deployment because of that.

Other people making a mistake is pretty common. Sorry you've had to deal with it, I've been there myself. Fixing others mistakes is pretty annoying. It's expecially annoying when they pretend like they already know everything they need to about git; refusing to learn anything new.

> So git's main problem from my perspective is that it's an extremely advanced, unforgiving tool that gives a false sense of expertise to many mediocre programmers.

Again, it's not extremely advanced. MS Word has more features/options than git does. And I'd never call git unforgiving. In-fact git has been my best friend; I deleted a live directory with a bunch of code that I (foolishly) didn't have backed up anywhere. Including a good portion of the .git directory. Thankfully, git was very forgiving to me, and I was able to restore most of it from the objects that git keeps. But that's something I didn't know how to do before deleting my repo. It's something I had to go out and learn.


>You've just described nearly every tool, show enough carelessness with a hammer and you'll certainly fuck something up.

True, but some tools are easier to be carless with. A hammer isn't one of them, which is why you don't find it in every kitchen. Git (and now that I think about it, every advanced command line tool) is very un-intuitive for many people. I've been using computers for several hours every day since 1997, so take me as whatever type of use you want, but I don't fully understand how rebase works yet. Or the hard flag. I'm sure if I sit down for an afternoon I'll understand but without that I won't. Which is what I'll define as "un-intuitive".

I chose to handicap myself here because the benefit till now has been very marginal. If I have a full afternoon to study I'd rather spend it on ML lectures or understanding something else, instead of source control.

However, this equation is changing, because my team is thinking of starting a mono-repo style coding architecture. This probably can't be done without full understanding of gits features, so I probably will spend the time needed to understand it's features, how it works, and some of the newer features that can be helpful in the pursuit. You don't have to be an expert in every tool you use every day, and a good tool is one which lets even a non expert not F it up, is all.


> but I don't fully understand how rebase works yet

Git maintains a tree of commits, each commit pointing to its parent. When you rebase, by default git finds the last-common-ancestor commit of the branch you're rebasing and the branch you're rebasing onto. That common ancestor is the base, and the subsequent commits on the branch you're rebasing are replayed on the latest commit of the branch you're rebasing onto.

> Or the hard flag

You mean reset --hard?


> described nearly every tool

Good programs aren't that easy to fuck up. Easy when messing with the file system, or deliberately destroying data, but not during normal use. Git is very easy to fuck up even during normal use (multiple people working on a software).

> when you handicap yourself, limiting to a subset of available features.

Yes. I practice very similar approach as GP, but I use couple other commands too, checkout, reset, clear, bisect.

Just because some people wanted a feature, doesn't mean I agree with their estimation of risk/reward. The risk being destroying couple days of other people's work. We were really close one time, didn't happen because my local copy was not yet synced.


> Git is very easy to fuck up even during normal use (multiple people working on a software).

I disagree that git design is responsible for this. If you have enough people doing something, especially when they all have different subsets of knowledge about the tool they're using. The chance someone will do something incompatible with everyone else rises. Git is clearly more complex than a saw, but give one to enough people who don't understand how to fell a tree, and ask them to build you a deck, oh and you're not allowed to talk to eachother. Something's gonna go badly.

> Just because some people wanted a feature, doesn't mean I agree with their estimation of risk/reward. The risk being destroying couple days of other people's work. We were really close one time, didn't happen because my local copy was not yet synced.

There's a story here, that I'm interested to hear. But git was kinda designed to avoid this exact thing. There's a reason that your local copy is 100% complete by default. Which means if you really came close to losing a lot of work. All of you were going out of your way to use git in a very not normal way.


> git design is responsible for this

Design of the VCS is almost fine. "Almost" because I would prefer to track renames, but I can live without that.

The CLI is horrible.

> I'm interested to hear

Someone used wrong command-line switch, and the merge commit was made in wrong way, destroying changes made in other branch. Then feature branch was deleted I think.

I don't know or care who did that or what was the command-line switch, the point is, the thing is too fragile. People aren't perfect, they make mistakes. Good interfaces are designed in a specific way, to reduce the probability and consequences of these mistakes. In some areas like flight control I think there're even laws about that.


What you described can't happen. If you merge one branch into another, both branches must exist in the repo. Deleting the feature branch following a merge, wouldn't delete the commits it contained. But even if that weren't the case. That means multiple people would have needed to all delete their feature branch without checking the code they wrote was merged and working. rm can delete code too, would you blame rm for having a confusing interface you just couldn't understand?

Come to think about it, git does warn you when you tried to delete a branch that's not merged into any other branch.


> That means multiple people would have needed to all delete their feature branch

That switch might have done something about rewriting history. Or maybe it was rebase, I never do either of these things. Multiple people (except me) have synchronized after that happened. If interested how we fixed — I’ve copy-pasted couple commands from a chat, sent by a co-worker who knows more about git. These commands pushed my local branch under a new name, then people managed to sort it out with a merge.


Just make sure everything is checked in and drop a tag on a known-good commit before any risky operations. You can easily recover to that tag with git reset.

There's also the reflog. The github interface probably has a friendly representation of it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: