Live data from Hacker News

Git undo: We can do better

blog.waleedkhan.name

71–80 of 490 posts

Re: Git undo: We can do better

#71
post #50

Earlier quoted context omitted.

Every single time we are discussing git this comment shows up. But why is one popular when the other one is so much better? I guess we will never know

GitHub is the reason. Turns out giving beer to developers globally is an effective way to get a technology adopted.

Bitbucket used to provide free (and pretty good) Mercurial hosting.

Re: Git undo: We can do better

#72
post #22

> novice users are terrified of it. When they make a mistake, many would rather delete and re-clone the repository than try to fix it In my experience most beginners use a GUI like Atlassian Sourcetree or the Github desktop client. It's a lot harder to make mistakes using the GUI in my experience. I still really like this idea though; eventually a subset of the beginners wants to learn the git cli and that sure seems…

I really love the Jetbrains GUI built into their IDEs for this.

Re: Git undo: We can do better

#73

This is an awesome idea. Can't wait to hear the objections from the purists.

I've watched the first case: amend a commit then undo. And I believe it shows serious shortcomings : - The interactive interface of `git undo` is probably too hard for beginners. Designing simple interfaces is hard, and you can't pplease everyone. - It seems `git undo` simply does a `git reset--hard` toward a designed commit. The user probably expected to return to the state before the last git action . Instead `git…

There is a design to address undoing changes to the index: https://github.com/arxanas/git-branchless/issues/10

It runs a `git checkout`, not a `git reset --hard`, so it will stop you if there are incompatible changes. Of course, if `git undo` can be made to lose your staged or unstaged work, then that's a bug.

Fortunately, you can undo the result of any `git undo` with another `git undo` that goes one more step back in time.

Re: Git undo: We can do better

#74

Earlier quoted context omitted.

I know (or, at least, have known ) how git works, in the way most people mean that (the data structures & on-disk layout, what a commit is, what a tag is, what a branch is, what HEAD is, staging, et c.). What I can't keep straight is WTF the commands are actually doing, in that low-level sense, which is a different thing, and there's approximately a 0% chance I'm ever going to use more than a tiny fraction of the com…

Take a look at https://eagain.net/articles/git-for-computer-scientists/ ? Maybe you've already read it, but this is what let me grok the underlying data.

The parent commenter makes it clear that they already grok the underlying data. The problem with Git, as explained so, so many times, is its horribly intuitive mapping from UI to the operations those commands preform on that model.

Comments like this, which points to a resource intended to help people "grok the underlying data", has the effect of seizing the focus of conversation and implicitly retargeting it to be concerned with with people who don't understand the underlying data model. When you been through this enough times, it just comes off as incredibly annoying and a source of tiresomeness.

Re: Git undo: We can do better

#75

Damn, this is such a GREAT idea. I've messed up repos a few times, and it's never good. It's always -- "what's the magic want I have to wave now"? The truth is, while we use git every day, most people really don't understand how it works. There I said it. And I'm not ashamed. I don't really know how Git works. And I think I'm not the only one. What does "git reflog" or "git reset --hard ...." do? What are the implica…

Are you using Git via GUI(s)? Between my colleagues, there is a strong correlation between using a GUI, and messing up the repository. I agree that Git's UX is pretty bad (checkout overloading; overlapping between checkout and reset; push overloading... yikes!), however, I believe that in contexts where using Git is a constraint, stop using GUIs is the best strategy one can apply to improve the understanding.

Not a single person I’ve met using git in the last decade has thrived using a UI for it.

Re: Git undo: We can do better

#76
post #11

How hard is `git reflog` `git reset --hard ` Or if you just want to move back 1 commit `git reset HEAD@{1}`

git reflog is hard enough so that I (a software engineer for 12 years and a git user for 10+ years) have to look up its syntax every time I need it.

Weird, it has no syntax...

Re: Git undo: We can do better

#77
While GitUp is a GUI app, and only available for macOS, I think it's worth noting that it has some great undo/redo capabilities built in.

From what I understand, some of them were more feasible to develop because they implemented their own plumbing (GitUpKit), instead of relying on the official git plumbing.

https://gitup.co/

Re: Git undo: We can do better

#78

Damn, this is such a GREAT idea. I've messed up repos a few times, and it's never good. It's always -- "what's the magic want I have to wave now"? The truth is, while we use git every day, most people really don't understand how it works. There I said it. And I'm not ashamed. I don't really know how Git works. And I think I'm not the only one. What does "git reflog" or "git reset --hard ...." do? What are the implica…

>The truth is, while we use git every day, most people really don't understand how it works.

Most people don't know how the Internet works and yet it's widely used.

You don't need to understand the inner workings of git. You just need to know some commands and some basic concepts.

Re: Git undo: We can do better

#79
post #66
post #50

Earlier quoted context omitted.

Every single time we are discussing git this comment shows up. But why is one popular when the other one is so much better? I guess we will never know

The Torvalds effect.

I know you imply, but this could also be interpreted as "battle proven" or how about "guaranteed to still work in 30 years"

Re: Git undo: We can do better

#80

This seems like putting a training wheel on a training wheel. git is already the easiest to understand of any VCS that I've used, and it's somewhat hard to do something in git that can't be reversed. As the articles states, it's unlikely you'll ever lose your changes. Further, this doesn't seem to be that different of a concept from git reset, so why not learn reset instead of yet another command?

> git is already the easiest to understand of any VCS that I've used Breaks down in uproarious laughter. One of the worst offenses git is its use of multiple different jargon terms for the same concept; indeed, it's the only VCS I've used where reading help leaves me less sure than when I started if it does what I want it to do. If I accidentally leave my system in a weird state (say, I'm in the middle of a git rebas…

What are the jargon words youre referring to? In my experience, it uses the same jargon as the other VCSs.

Perhaps you have a different workflow than me, but I don't find myself rebasing all that often to begin with. I generally don't rewrite history unless I truly fucked up. And since I'm in "I fucked up" mode, I take extra care with commands I type.

I don't wanna be like Apple and say "You're holding the phone wrong," but maybe you shouldn't be doing frivolous rebasing.

Post reply on HN