6 ms·
The ease of use is a big thing for me. I find Git a bit arcane -- it's better than it used to be (around the Hg 0.9 era), but it's still quite bad. Hg has this
by philpem 7y ago
The ease of use is a big thing for me. I find Git a bit arcane -- it's better than it used to be (around the Hg 0.9 era), but it's still quite bad.
Hg has this way of actively pushing you towards the safe way of doing things (e.g. if you try to change history). Git will let you blow away a month's work if you mistype a command.
I get the impression Git is the popular option because it underpins the Linux Kernel and Android development processes. That means it's popular, not that it's perfect for every use case.
Mercurial is especially powerful when given to developers who know Subversion. A ~20% productivity boost just from being able to losslessly branch off and merge back without worrying about stepping on other devs' feed.
Another team found out about it and were interested, but ultimately deployed Subversion -- because having one authoritative repository in one place was important to their process.
- bschwindHN 7y ago> Git will let you blow away a month's work if you mistype a command What's the command to mistype?
- fnord123 7y agoMaybe git push -f my-branch I can't imagine having a month of work on a local machine that hasn't been pushed anywhere so it has to be something about pushing.
- airstrike 7y ago> Git will let you blow away a month's work if you mistype a command. Fortunately, that can always be undone with another command
- jhasse 7y agoHow to undo git checkout . ?
- airstrike 7y agoThat's like asking how to undo `rm -rf`
- nemetroid 7y agoIt really is. Sure, it is an issue that it's the same subcommand as you use for many other things (which is being worked on with git switch/restore), but there is no other context where you'd do `git checkout .` if it wasn't your direct intention to get rid of changes in your workspace.
- jhasse 7y agoMercurial creates backup files though.
- Rusky 7y agoThe only way for `git checkout .` to blow away an entire month of work is if you didn't add or commit anything for an entire month.
- jhasse 7y agoFair enough ;)
- jlebar 7y ago> Git will let you blow away a month's work if you mistype a command. It's sad to hear someone say that, presumably you've been bitten by it. What you describe is not true. While it's easy to blow away work you haven't committed, every commit you've made in the past month is saved in the reflog. Going back to any one of them is as easy as finding it and typing git reset --hard. Erasing something from the reflog is hard. Possible, but it's not going to happen by mistyping a command or two. Makes me sad because of course I agree the git UI is terrible, and I don't blame any user for not being able to figure it out. Although Googling "how do I recover lost git commit" does pull up useful results.
- KaoruAoiShiho 7y ago> While it's easy to blow away work you haven't committed This is bad enough. Git treats your workspace as trivial that can be replaced willy nilly.
- jlebar 7y agoI don't believe hg is any better in this respect.
- yjftsjthsd-h 7y agoI can tell you that it is in at least one use case that I've hit. If you have local uncommitted changes to a file, and then run `hg revert file` to undo your changes, it creates (by default) a ".orig" backup. The equivalent git command (`git checkout --hard` or something?) will just throw out local changes with no takebacks.
- philpem 7y agoI would absolutely love it if Git had this feature. Having it on Hg has saved me so many times.
- philpem 7y agoI've lost a day's work to a mistyped "git revert HEAD~n"; my colleague blew away his month's work with a mistyped attempt at a squashed commit. Neither of us knew about Reflog at the time, so that didn't even get onto the list of things to try. Management asked "what if you do that with Mercurial?" Answer is, well, it won't let you do it without installing an extension. And the Wiki page for that extension contains a bunch of warnings about how you really should think long and hard about what you're trying to achieve -- and make as many backups as you can. TRWTF of course is that my colleague hadn't pushed upstream for a month. Like I said -- former Subversion user. He didn't want his commit to mean someone else had to do a merge, and he didn't want anyone to see it until it was done.
- umvi 7y ago> Git will let you blow away a month's work if you mistype a command. No, it won't. It's much harder to lose work in Git than you think. But really, if your remote repository is setup correctly with protected branches, this should never happen.
- philpem 7y agoI've never worked at a company with protected branches... even though it's best-practice. "Because some day someone might need to push to master to do a hotfix". So I have a local git push hook which blocks master pushes :)
- facorreia 7y agoOne thing I love about git is how it makes it almost impossible to lose work once it's committed. That's why I commit early and often.