r/programminghorror • u/DaPragmaticProgramer • Jul 01 '16
[RANT] Git Sucks!
There, I said it.
Now that I succeeded in irritating most people, let me explain: Git is an error prone overkill for most small and medium sized projects.
Remember, Git was created to handle Linux development; most projects have a single relationship with the remote server. So, first, it’s an overkill to use, like shooting pigeons with a Cruise missile.
Second, because of its power, it’s extremely complex and makes it really easy to shoot yourself in the foot.
Most version control systems need a page or two to explain the basic commands. The Pro Git book is 550+ pages long.
So why, you, as a developer would use Git? What happen to "the best tool for the job"? What happened to KISS (not the rock band)?
Is it because you want to look cool? Or you think your project is going to be as large one day as the Linux kernel? Or your company is forcing you to?
I apologize for my first post being a rant, but recently I was forced to use Git in a new repository and it has been nothing but pain, for almost every simple step my old trusty GitHub GUI started throwing errors.
Looking online, it’s like a rash – it’s not only me getting into issues. So the problem is deeper, I believe with the model itself. We need a simpler CVS; any suggestions?
11
u/eshultz Jul 01 '16
I disagree, to the contrary, git makes it incredibly hard to fuck up the repo beyond repair. In my experience the magic of git is that nearly anything and everything you do can be undone. Because of the complexity and the fine grained control, it's not necessarily easy (though for the most part, it is very easy) to undo mistakes, but in order to rewrite history in a way that is not recoverable, you have to be very deliberate and know exactly what you're doing. There's no way a beginner is going to somehow break the entire repo beyond repair. But there's also no way a beginner is going to be able to repair those mistakes easily. Git is complicated.
I agree 100% that git is not easy. It's just not. That doesn't mean it's a bad tool - it just means that you shouldn't use it for production version control if you have no idea what you're doing. As with most powerful tools, it's best to start with training wheels.
I am a SQL developer, and a lot of people who are new to SQL have the same sentiment as you do for git. The problem is the idea that because something is difficult to learn or doesn't fit your mental model, it is therefore not a good tool. With SQL, beginners often struggle with the language because they try to apply procedural thinking to a language that is mostly declarative - rather than telling the computer exactly how to get the data, you tell it what data you want and how to relate it to other data, and it tries to take your demands and retrieve what you asked for. Beginners often try to apply their procedural logic and end up with really long, non performant queries that do unexpected things.
The same sort of thing happens in git - you try to make it work the way that you think it should work, and you end up with a big mess. The only solution is to actually spend time learning how to use the tool the way it was intended. You can't just decide you're going to use git, dump your project into a repo and start working. You're going to spend way too much time researching how to do simple things, you're going to get it wrong because there are so many ways to accomplish the same task, and you're going to be frustrated and give up. Spend a few hours doing some interactive online tutorials first (training wheels). Then make a project of your own, a simple app or program, and use git/GitLab/GitHub for the whole thing (now we've removed the training wheels and we're just riding around the block).
Once you get the hang of it, try some more advanced stuff like only making changes in new branches and merging them into master once completed. Try to purposefully create conflicts and learn how git resolves them. Learn how to manually resolve a merge conflict. Learn how to rebase, learn what pull requests do, learn how to fork code, learn how to chain remotes, learn how to reset and revert and what the difference is, keep going. Now you're riding miles a day and the bike (git) feels like an extension of yourself.
I can't stress enough how important it is to take it slow and learn the features in and out. There are a dozen ways to do every little task in git. If you're not comfortable then don't use it for critical projects.
If all you need is a linear history of your project, git is probably not the best choice if you aren't already familiar with it. If you need the ability to work with teammates on the same project, git becomes a better choice. If you need the ability to work on the same code in the same files at the same time with teammates who may or may not have the latest version of the code, git starts to look like the only real option.
Git can be extremely complicated, that's definitely true. But that complexity is necessary if you want the degree of control and protection that git offers.
Again, there's nothing wrong with just having a project sitting on a server somewhere that you copy, edit, and replace. There's nothing wrong with just backing up the project on a daily basis and restoring when things go haywire. Git is not meant to be an easy replacement for that sort of versioning.