Live data from Hacker News

Magit, the magical Git interface (2017)

emacsair.me

351–357 of 357 posts

Re: Magit, the magical Git interface (2017)

#351

Earlier quoted context omitted.

What I dislike with git terminal UI is that commands reflect the innards of git, not what the user wants to do. It also forces a deeper understanding of the innards for basic commands than ought to be necessary. Examples where undoing an operation looks totally different to doing it: - To stage a change you `add` it, to unstage you `reset HEAD` - To commit you `commit`, to undo a commit you `reset --hard HEAD^` The l…

"- To commit you `commit`, to undo a commit you `reset --hard HEAD^`" You're not meant to delete commits like that. Git encourages you to stop "lying about the past", and you will run into a fair amount of trouble if you try to do so with shared history. You don't remove a commit "backwards" and change history; you add a new commit that undoes the previous one (git revert)

> You're not meant to delete commits like that.

Couldn't disagree more. To me, one of the massive advantages of Git over other VCS tools is the support and completeness of its ability to edit time. You are the editor not just of the content under control, but over its branched evolution. Accepting this and working with time gets you to a next level of control.

The first step in this process is really internalizing the tree of commits, and seeing branches not as lines of development as much as simple pointers on that tree. In many VCS systems, branching is a big deal. In Git, a branch is just a smart tag that is automatically updated by HEAD. Users new to Git need to get comfortable creating branches at a whim as the tree grows.

The next step is getting comfortable with editing the tree itself. Primarily, I recommend using interactive rebasing liberally. This has multiple positive side effects:

1. It causes the author to think at a higher-level of the primary artifact they're constructing — the tree of incremental changes.

2. Authors begin to think about the repository as more than a dumb file backup system, but instead as a history with true utility, and so begin to construct "stories" in that evolution that are instructive and useful to future readers of that history.

3. It takes the author out of the flow of time, and encourages them to think about ways to change the past (within limits, of course) so that the constructed history is improved.

All of this, of course, with the caveat that shared history changes must be coordinated (and frequently avoided). You can get very far thinking this way just about your un-pushed topic branch.

There's a very real philosophical difference between those who see VCS as a secure audit trail (where changing history is "lying about the past"), and those who see a repository as a whole constructed artifact of intrinsic value, wholly editable as its contents. In this latter view, editing a line of source isn't "lying" about that line's contents, and neither is editing time.

Re: Magit, the magical Git interface (2017)

#352

Earlier quoted context omitted.

> I don't feel like I'm fighting the git tools. Is this a common experience? Yes. Today I spent way too much time explaining to a coworker that what he was complaining “should be easy to do but seems impossible” was actually quite simple, only to spend ages explaining how git works, why he wasn’t understanding the paradigm. And after all that help what he needed to do was simply to “git checkout feature-A && git merg…

“minimal viable knowledge" describes my git knowledge. I simple don't have time to become a git expert. After all git is only a source control tool, there are way more important things to deal with that impact our customers.

> “minimal viable knowledge" describes my git knowledge. I simple don't have time to become a git expert.

Isn't there some middle ground between "minimal viable" and "expert" that you could (should) aspire to, like "reasonably competent"?

Re: Magit, the magical Git interface (2017)

#353

Earlier quoted context omitted.

“minimal viable knowledge" describes my git knowledge. I simple don't have time to become a git expert. After all git is only a source control tool, there are way more important things to deal with that impact our customers.

> “minimal viable knowledge" describes my git knowledge. I simple don't have time to become a git expert. Isn't there some middle ground between "minimal viable" and "expert" that you could (should) aspire to, like "reasonably competent"?

I think I am reasonably competent to do my job. I just don’t think there is much value in learning more. It’s just a version control system.

Re: Magit, the magical Git interface (2017)

#354

Earlier quoted context omitted.

> “minimal viable knowledge" describes my git knowledge. I simple don't have time to become a git expert. Isn't there some middle ground between "minimal viable" and "expert" that you could (should) aspire to, like "reasonably competent"?

I think I am reasonably competent to do my job. I just don’t think there is much value in learning more. It’s just a version control system.

> I just don’t think there is much value in learning more. It’s just a version control system.

I think it's not a matter of "just" a version control system; it's vital enough to (most of) our jobs that being more than just "minimally viable" good at it is an integral part of being reasonably competent.

But who am I to talk; at work, I almost exclusively use Informatica's built-in "version control system", which IMO... isn't much of one; actually, hardly is one in the first place. Getting to use git (or similar) again is what Idream of. Then again, maybe that just means I'm only "minimally viable" with Informatica's system. :-)

(All out of Spätzle, have to wait for next "Alpenfest" week at Lidl. :-( )

Re: Magit, the magical Git interface (2017)

#356

Earlier quoted context omitted.

> I also do this regularly, but on my terminal. I don't feel like I'm fighting the git tools. Is this a common experience? Trying to stash some of the changes is pretty annoying, yes. New files don't want to cooperate with stashing, and there's no way to stash just staged things like making a commit; you have to use -p.

You have to do it in two steps with --keep-index. Or use magit that has a stash index option.

I used this feature enough that I forgot/never even knew that it wasn't built in to git-stash.

Re: Magit, the magical Git interface (2017)

#357

Earlier quoted context omitted.

"- To commit you `commit`, to undo a commit you `reset --hard HEAD^`" You're not meant to delete commits like that. Git encourages you to stop "lying about the past", and you will run into a fair amount of trouble if you try to do so with shared history. You don't remove a commit "backwards" and change history; you add a new commit that undoes the previous one (git revert)

> You're not meant to delete commits like that. Couldn't disagree more. To me, one of the massive advantages of Git over other VCS tools is the support and completeness of its ability to edit time. You are the editor not just of the content under control, but over its branched evolution. Accepting this and working with time gets you to a next level of control. The first step in this process is really internalizing th…

Interactively rebasing your local changes instead of sharing a hodgepodge of brain vomit is great, but don't go around rebasing history that's already out there between a team of developers unless you have a really, really good reason to.

I did specify that rewriting shared history is going to cause you trouble (unless you really know your way around things), but apparently it wasn't clear enough

Post reply on HN