News for hackers. Stuff that matters.
Re:Ask HN: What's the worst piece of software you use everyday? by dasil003 on Saturday July 11, 2020 @04:29PM (#23805642)
Disagree strongly on git. On the surface the syntax is ugly, but the data model is brilliant.

Once you wrap your mind around what commits, heads and remotes are and learn to rebase you get an incredibly simple and fine-grained control. I never use stash because it's trivial to create a WIP commit and rebase later into the chunks I want to ship to permanent history.

Git is like a chef's knife: extremely powerful tool that's dangerous in untrained hands.

Re:Ask HN: What's the worst piece of software you use everyday? by crispyambulance on Saturday July 11, 2020 @09:50PM (#23807982)
> On the surface the syntax is ugly, but the data model is brilliant.

It's beyond ugly, it's needlessly incoherent. I use it because I have to and hate it. I've heard people say "the data model is a work of beauty". And I suppose that's true, but why have such a fucked up and confusing set of commands? Doesn't a "brilliant data model" deserve an equally brilliant command line?

The thing that saves git is that it works, and by some miracle, it is popular. People just memorize what they need to do for their workflows and that's mostly fine. Sometimes there's a screw-up and you blow time googling around or looking up fixes.

People won't publicly admit it but a lot of work gets trashed because finagling git intricacies is more painful than throwing away some work and starting over.

Re:Ask HN: What's the worst piece of software you use everyday? by arp242 on Sunday July 12, 2020 @01:30AM (#23809091)
> by some miracle, it is popular

Probably because Linus Torvalds wrote it, and also because GitHub was actually quite a significant improvement over SourceForge. I know some people "love to hate" GitHub, but they made some really good "developer-first" UX improvements that many copied for good reasons. And lastly, Linus Torvalds wrote it.

I still maintain that Mercurial is far better for most uses. Every time I mention this I get a flurry of technical replies about stuff most people don't even know about (HN is strongly biased like that, which is not a bad thing, just something to be aware of), but most people just want to commit, push, pull, and some related stuff like that. Git makes a lot of simple common stuff arcane to make the complex stuff easier, whereas mercurial makes the simple common stuff easy and keeps the complex stuff arcane. This strikes me as a much better design philosophy.

Git and Mercurial are a tool designed to facilitate writing code (which is also a tool designed to solve problems). If you need to spend significant time to "get your head around it" then IMHO something, somewhere, has gone wrong.

I still use git because it's just the pragmatical thing to do at this point in time, and to be fair there have been active efforts by the git team to make the common/simple stuff easier in recent times, but yeah, I'm not a fan.

Re:Ask HN: What's the worst piece of software you use everyday? by crispyambulance on Sunday July 12, 2020 @12:58PM (#23812765)
> Probably because Linus Torvalds wrote it, and also because GitHub was actually quite a significant improvement over SourceForge.

I'd say it was because GitHub created a solid community that worked. And yes, Sourceforge was a huge piece of garbage with it's awful clickbait, misleading "download" buttons, and scammy crapware foisting.

That Torvalds wrote git doesn't automatically make me want to use it, I think most people feel the same.

Re:Ask HN: What's the worst piece of software you use everyday? by namdnay on Sunday July 12, 2020 @02:49AM (#23809406)
Yes! I love Mercurial, it feels like someone designed a proper interface, instead of just exposing the internal api calls
Re:Ask HN: What's the worst piece of software you use everyday? by y7 on Saturday July 11, 2020 @05:31PM (#23806220)
I use git a lot, and I like the speed and decentralized nature. But I do think there's much to be improved.

Named branches don't really exist in git: there's only a moving target name that refers to a leaf node. This means there's no "history" associated to a branch except for the parent commits. But in merge commits with several parents all parents are considered equal, and the system does not contain info about which commit belonged to the "main branch" and which was imported in. This information can be valuable in some cases. This leads to a lot of rebasing just to keep the commit log clean, but this actually rewrites history and destroys information.

Also, there's no support for keeping two parallel views of the same repository (for example, an internal view with lots of subcommits, and a cleaner public view with more detailed messages, and perhaps fewer privacy-compromising names/timestamps).

Finally, handling merge conflicts is still a PITA, especially on LaTeX documents.

Re:Ask HN: What's the worst piece of software you use everyday? by nyanpasu64 on Saturday July 11, 2020 @08:28PM (#23807492)
> But in merge commits with several parents all parents are considered equal, and the system does not contain info about which commit belonged to the "main branch" and which was imported in.

I thought that merge commits stored an ordered list of parents, and the first parent is generally the main branch, and second parent is a side branch.

Re:Ask HN: What's the worst piece of software you use everyday? by mikeyjk on Saturday July 11, 2020 @09:51PM (#23807987)
It does! I'm not sure what that person is referring to. git log can even use ASCII art to depict the relationship. Most modern git web frontends depict the relationship. Sourcetree, gitkraken depict the parent relationships. I wonder if we're misinterpreting? But the parents are distinct from one another, the hierarchy is not lost on merge. Part of the reason I prefer merge commits rather than rebasing.
Re:Ask HN: What's the worst piece of software you use everyday? by smichel17 on Saturday July 11, 2020 @10:22PM (#23808184)
Note: they don't have to be exclusive. You can rebase a branch so the history is linear, then merge --no-ff and create a merge commit for it. This gets you something like the best and worst of both worlds.
Re:Ask HN: What's the worst piece of software you use everyday? by skeppy on Saturday July 11, 2020 @05:56PM (#23806440)
What about a “git init-lite” option?

So many times I want to VC a directory but don’t care about commit messages, branching, or other jazz more suited to collaborative work.

With init-lite, all the power of Git is still there - and you can use any commit or command you want, but it’s default would be to simply VC for every file save. In other words, a file save IS a message-less commit.

Re:Ask HN: What's the worst piece of software you use everyday? by icebraining on Saturday July 11, 2020 @08:33PM (#23807529)
This exists: it's the git-annex assistant! You just have to configure the "annex.largefiles", because by default git-annex doesn't actually commit the content of the files, since it's designed to handle large binary files.

But if you set that option and run the Assistant, it'll auto-commit files when they change, and can even auto-sync them with other computers, cloud storage, Android devices, etc.

https://git-annex.branchable.com/assistant/

Re:Ask HN: What's the worst piece of software you use everyday? by still_grokking on Saturday July 11, 2020 @06:29PM (#23806701)
Sine decades I wish this would be a std. OS or FS feature!
Re:Ask HN: What's the worst piece of software you use everyday? by boring_twenties on Sunday July 12, 2020 @07:20AM (#23810545)
Back in the stone age I worked at a place that used a VCS called ClearCase. It supported exactly this, you'd be able to append things like @revision or @branchname or @timestamp to file and directory names to access them.

Unfortunately, it required (IIRC) three full time people to administer the server. As for the client (my workstation), it required a proprietary kernel module which would panic about once a week. I'm told our license cost $1m/year (2001 dollars).

Re:Ask HN: What's the worst piece of software you use everyday? by vtbassmatt on Saturday July 11, 2020 @10:18PM (#23808154)
Re:Ask HN: What's the worst piece of software you use everyday? by dreamcompiler on Saturday July 11, 2020 @10:50PM (#23808342)
Indeed. I still miss VMS because of its automatic versioning, with version numbers being an explicit field of the pathname.
Re:Ask HN: What's the worst piece of software you use everyday? by chipotle_coyote on Saturday July 11, 2020 @11:22PM (#23808537)
It's something that exists in macOS, but as far as I know applications have to explicitly choose to use it. Most applications that support it have a "File > Revert To > Browse All Versions..." command available. BBEdit -- as often the case -- has a more useful variant of it, which brings up a diff window with "Search > Find Differences > Compare Against Previous Version". (It actually lets you choose any recorded previous version.)
Re:Ask HN: What's the worst piece of software you use everyday? by sangnoir on Saturday July 11, 2020 @06:19PM (#23806635)
The good news is that git is extensible enough to support this use-case. You would need to wrap git with a tool/script that watches for file changes
Re:Ask HN: What's the worst piece of software you use everyday? by dreamcompiler on Saturday July 11, 2020 @10:46PM (#23808316)
> This leads to a lot of rebasing just to keep the commit log clean, but this actually rewrites history and destroys information.

Completely agree. I think rebasing is misguided. The objective is to keep history clean and linear. The proper way to solve that problem is with smart log analysis for different customers, not fictionally rewriting the log itself.

Re:Ask HN: What's the worst piece of software you use everyday? by millimeterman on Saturday July 11, 2020 @04:35PM (#23805682)
I think the best argument against git is to use mercurial for a few months. It has exactly the same functionality but a nicer and more streamlined interface, especially when it comes to branch management.
Re:Ask HN: What's the worst piece of software you use everyday? by arp242 on Sunday July 12, 2020 @01:33AM (#23809108)
I think this point can be concisely summarized with:

  $ git help commit | wc -l
  506

  $ hg help commit | wc -l
  59

  $ hg help commit -v | wc -l
  96
Also, git currently has 169 subcommands by default, vs. mercurial's 50 (more available as extensions though).
Re:Ask HN: What's the worst piece of software you use everyday? by nickpeterson on Saturday July 11, 2020 @08:15PM (#23807414)
Yeah, when dvcs started becoming all the rage I tried mercurial first for some toy projects and really liked it. When I finally had to start using git I was absolutely baffled that it had won. I feel like git needs something that sits on top and does most the normal configuration and wraps the api. It reminds me of the problem with emacs, there is so much it’s just overwhelming to people.
Re:Ask HN: What's the worst piece of software you use everyday? by smichel17 on Saturday July 11, 2020 @10:26PM (#23808203)
Technically this already exists; git commands are divided into two groups, plumbing and porcelain. Plumbing commands have stable interfaces and are intended for building alternative interfaces with; porcelain commands are intended to sit on top and be the actual user interface. They're what you're used to using.
Re:Ask HN: What's the worst piece of software you use everyday? by dreamcompiler on Saturday July 11, 2020 @10:53PM (#23808360)
I love mercurial but since I've gotten used to git I miss the lack of the staging area and stash in mercurial. I have to grudgingly admit they're very useful.
Re:Ask HN: What's the worst piece of software you use everyday? by ptx on Sunday July 12, 2020 @09:08AM (#23811052)
In some cases (all my usecases, but perhaps yours are different) the staging area can be replaced by some combination of "hg commit --amend" and "hg commit --interactive" - or in older versions "hg rollback" and "hg record".
Re:Ask HN: What's the worst piece of software you use everyday? by arp242 on Sunday July 12, 2020 @01:36AM (#23809121)
You can get the "git stash" with the shelve extension: https://www.mercurial-scm.org/wiki/ShelveExtension
Re:Ask HN: What's the worst piece of software you use everyday? by smichel17 on Saturday July 11, 2020 @08:16PM (#23807426)
Do you think mercurial has a better data model, or could git reach parity with just a better interface?
Re:Ask HN: What's the worst piece of software you use everyday? by millimeterman on Friday July 24, 2020 @10:32PM (#23946447)
I don't know anything about mercurial's internal data model, so it's hard to say. In particular, it makes some fundamentally different choices (e.g. no staging area, the ability to use unnamed branches). I certainly think git could do a lot better with its interface though.
Re:Ask HN: What's the worst piece of software you use everyday? by nyanpasu64 on Saturday July 11, 2020 @08:27PM (#23807486)
I understand Git, but for my rebase-based workflow, I don't like how Git doesn't understand commit identity when you rebase. Git doesn't know the old and new commits with the same name and contents mean the same thing, though rebase tries to skip commits it thinks match.

When you rebase one branch, it doesn't move other branches and tags pointing along the history.

You can't rewrite a repository and change your username in past commits, without completely rewriting all of history, creating two parallel histories, and merge conflicts.

Git's mental model makes "moving a branch onto a different commit" (git branch -f) a natural operation. But no graphical tool I've used allows you to do that on a branch you're not checked out on.

Re:Ask HN: What's the worst piece of software you use everyday? by Stratoscope on Saturday July 11, 2020 @09:33PM (#23807880)
> Git's mental model makes "moving a branch onto a different commit" (git branch -f) a natural operation. But no graphical tool I've used allows you to do that on a branch you're not checked out on.

This is trivial in SmartGit, I do it all the time.

Simply drag the branch marker to the commit you want it on. It doesn't matter if it's the checked-out branch or not.

I've tried a few Git GUIs, but SmartGit continues to be my favorite. Pretty much every one of the recipes on https://ohshitgit.com/ is just a simple drag and drop or menu command in SmartGit.

One of my favorite things is the way it handles the reflog. Just click the Recyclable Commits checkbox and every reflog commit becomes visible in the normal log view. You can see the commit's file contents without having to check it out, you can diff two reflog or normal commits, etc.

https://www.syntevo.com/smartgit/

Re:Ask HN: What's the worst piece of software you use everyday? by fulafel on Sunday July 12, 2020 @03:22AM (#23809536)
Rebasing breaks a lot of what's good in git.
Re:Ask HN: What's the worst piece of software you use everyday? by daenz on Saturday July 11, 2020 @04:45PM (#23805775)
I agree on these points, however many developers don't care enough to use it well, so you get screwed up shared histories, bad commits, mis-merged branches. I know that the nature of a shared tool, but it definitely negates a lot of the potential benefits of doing everything The Right Way if nobody else puts in the same effort.
Re:Ask HN: What's the worst piece of software you use everyday? by kubanczyk on Saturday July 11, 2020 @07:18PM (#23807065)
How about putting some tought into not naming operations so that `pull` is not the opposite of `push`.

Don't you think the merge histories of all the repos throughout the globe would be greatly improved if people didn't need to learn the hard way that if your colleague does `push` you need to `fetch`?

Re:Ask HN: What's the worst piece of software you use everyday? by smichel17 on Saturday July 11, 2020 @10:00PM (#23808039)
Also, rm is not the opposite of add, `restore` is (and previously `checkout` was).
Re:Ask HN: What's the worst piece of software you use everyday? by bmitc on Saturday July 11, 2020 @06:14PM (#23806597)
> Once you wrap your mind around what commits, heads and remotes are and learn to rebase you get an incredibly simple and fine-grained control.

> Git is like a chef's knife: extremely powerful tool that's dangerous in untrained hands.

Although, this is all part of the problem with Git. The problem is that it exposes this fine-grained control and knife's edge to the user by default. There isn't some simpler model that people can work with.

I cut my teeth on source-code control with Perforce. Of course, Perforce has many complex features, including stuff like workspaces, which as far as I can tell, Git doesn't have something like that. Anyway, despite its complex feature set, Perforce can be explained in a few minutes. You have some code in the repository. If you want to work on it, you check it out and it gets added to a changelist. If you want exclusive change rights, you can lock it to prevent others. If you want others to see what you're working on, you can shelve your changes without submitting so that they can inspect. When you're done, you submit your changelist. All of this can be done via excellent visual tooling or the command line. I highlighted things with italics because these are the right words for the actions in how Perforce calls them. It's intuitive.

For Git, it isn't that simple. You must first explain a wide swath of concepts. I've explained Git to people, even using the GitHub Desktop app. It is very confusing and intimidating to people, and rightfully so. It confuses me, and I did some pretty advanced things with Perforce (and thus source-code control) before. And there's no default visual tooling. Git also has many names for things that are confusing. Also, Git was invented for a very specific purpose: Linux kernel development. The vast majority of development does not need the same complexity that such a niche development process needs.

When I recently wanted to do something in Git, I just could not figure it out. Probably simple for a Git expert, which is something I am not, but after searching many forum posts, I gave up because every answer was different and caveated in different ways and wasn't working for me. I installed GitKraken and solved my problem in seconds via a single right-click. Maybe I'm an idiot and I don't understand Git that well; both are likely true. But I am able to understand other complex things, so something is amiss. I think the primary issue is that Git requires me to study it just to use it in basic ways. I have an allergy to overly complex things, and so it's just a constant struggle for me. I tend to use visual tools for merging, diffing, managing commits, etc. so that I stay away from the Git CLI, which exposes the complexity in a non-usable way.

Lastly, Git is very narrow minded when it comes to things it controls. It assumes everything should be text.

Re:Ask HN: What's the worst piece of software you use everyday? by tsimionescu on Saturday July 11, 2020 @06:53PM (#23806874)
Absolutely agree! Coming from P4 to Git, Git is just constantly getting in the way.

I need to make more decisions because of its limitations (single repo or one repo per module? Or maybe use submodules somehow? With P4, we had a single repo with all of the code of the entire organization).

Should I rebase or merge? Or squash commits? Should I cherry pick onto a new branch?

If I want to checkout a new branch while I have work in progress, do I commit it and later amend or revert, or do I stash it? Or do I rely on autostash?

Do I push directly to main, or do I rely on pull requests? Should those merge or squash commits?

I understand that all of these options and concepts make sense for distributed orgs, like the Linux kernel dev community and many other opensource projects. But I don't understand why so many traditional organizations are adopting Git. Its model is way too complex for the way normal orgs work (1 centralized server as the source of truth for the whole project), and it has serious limitations for anything which isn't pure code and isn't carefully curated.

Re:Ask HN: What's the worst piece of software you use everyday? by PaulDavisThe1st on Saturday July 11, 2020 @07:35PM (#23807173)
>Should I rebase or merge? Or squash commits? Should I cherry pick onto a new branch?

From my perspective, these are policy decisions that need to be made by some "management-ish" level. Git provides the mechanism to do all of them. It's up to you/your organization to decide how to work.

In the open source project that I run (20 years, 75+ developers over time, 400-500k LOC) we all have a clear understanding of (e.g.) whether to merge or rebase. On the odd occasions that there's a lack of clarity, it's normally a great sign that it doesn't matter.

The fact the you would be asking those questions suggests to me that the necessary policy-level decisions have not been made (or have not been made clear).

Re:Ask HN: What's the worst piece of software you use everyday? by tsimionescu on Saturday July 11, 2020 @07:50PM (#23807262)
I'm not saying this is a decision every dev has to make. I am complaining about having to make these decisions as a team or team lead. Having choices is only nice if there are important use cases where each choice is useful, and if the difference is big enough. Otherwise, the choices are just adding complexity and buyer's remorse.

For most unitary organizations, some of the options that git gives you make no sense at all. That doesn't mean git should change, it means that it's not a great tool for unitary organizations.

Note that some of the choices (e.g. stash vs commit) are choices that each dev has to make individually, and some are pure incidental complexity.

Re:Ask HN: What's the worst piece of software you use everyday? by allarm on Saturday July 11, 2020 @09:42PM (#23807946)
So git gives you too much freedom, that’s what your complain is about? I find it hilarious.
Re:Ask HN: What's the worst piece of software you use everyday? by tsimionescu on Sunday July 12, 2020 @02:10AM (#23809262)
This is not 'freedom' it is excessive complexity.

`ls` wouldn't be better if I had to pass a flag to see the output as today, and another flag to print one character per line, and another flag to print each character in a different color etc. (even though that would give me 'more freedom').

Re:Ask HN: What's the worst piece of software you use everyday? by allarm on Sunday July 12, 2020 @12:27PM (#23812498)
I don’t think that git forces you to use all these bells and whistles. Also I am not sure if ls would be better with additional flags, but it won’t be worse because of that, that’s for sure.
Re:Ask HN: What's the worst piece of software you use everyday? by chipotle_coyote on Saturday July 11, 2020 @11:37PM (#23808592)
There is a difference between "too much freedom" and "not enough direction."
Re:Ask HN: What's the worst piece of software you use everyday? by allarm on Sunday July 12, 2020 @12:22PM (#23812453)
Sure there is - the difference is so huge that I don’t see any similarities. Though professional software should not direct you, thus limiting you in choices. Your expertise should do that. And if your expertise is not enough to make an educated choice it’s not a problem of the software.
Re:Ask HN: What's the worst piece of software you use everyday? by bmitc on Saturday July 11, 2020 @08:54PM (#23807663)
Those are hard decisions to make in organically developed organizations like companies.

Part of the problem is that Git, to make it manageable, requires all of these types of concerns and decisions to be addressed, and secondly, it has somehow become the only standard that people have even heard of. There isn't even a decision about which system to use anymore.

Having used both, I still prefer Perforce over Git. And if it were up to me, I would take a step back and investigate other offerings like Plastic SCM. But trying to make these decisions is nearly impossible now that Git is treated as a given.

Re:Ask HN: What's the worst piece of software you use everyday? by mikeyjk on Saturday July 11, 2020 @09:57PM (#23808029)
I seriously disagree. Branching models are one of the few things that can be decided upon at short notice. It shouldn't be changed every day, but going from merge commits to rebasing is not going to prevent anyone from working. The VCS history will just look confusing temporarily.
Re:Ask HN: What's the worst piece of software you use everyday? by f1refly on Sunday July 12, 2020 @04:31AM (#23809859)
Coming from p4 to git, I thanked the heavens for not having to use this piece of garbage anymore! File locks? Multiple changelists? God forbid that one colleague who checked out some file went on vacation, neverending fun talking to admins of the server to do something about that! Rebasing commits? Own branches? Own repos? Nope!
Re:Ask HN: What's the worst piece of software you use everyday? by tsimionescu on Sunday July 12, 2020 @11:32AM (#23812085)
I miss multiple changelists so much! I very often am working on a longer feature when I also get some small bug, and it's so nice to organize that into a separate changelist.

Also, file locks are awesome if you're working with binary files (a thing that P4, unlike Git, can actually do), or even when doing a big refactoring that you know will cause conflicts with any other change. Otherwise, at least on our server, we very rarely used them (ignoring the temporary lock just as you're submitting code).

I'm not sure what you mean about rebasing. The basic P4 workflow is equivalent to `git pull --rebase`. In fact, it's pretty hard NOT to rebase in P4.

Also, why is your own branch useful actually? Nevermind your own repo? You can always just keep multiple copies of the code if you really want to.

Also, with P4 you don't have to cleanup your whole working set just to switch branch - it's just a `cd` away!

Of course, different strokes for different folks and all that.

Re:Ask HN: What's the worst piece of software you use everyday? by yawaramin on Saturday July 11, 2020 @09:42PM (#23807943)
I feel like I'm back in the aughties reading this post :-) These arguments were all made back in the day, substituting in CVS or Subversion or what have you for Perforce. And yet time marched on and millions of people found that, yes, they could indeed use git. Especially with all the UIs that have sprung up around it. That's the thing really–you don't need to be an expert git CLI user to get value from git. You just need to find one or more UIs that do what you need.
Re:Ask HN: What's the worst piece of software you use everyday? by tryptophan on Saturday July 11, 2020 @04:52PM (#23805843)
Agree. I always hated git and thought it was so arbitrary and unhelpful. Then I sat down for 1-2 hours and read about how it works. It's not that complicated of a model that it operates on. Once you learn the model, the rest of the commands and how it works start making intuitive sense.
Re:Ask HN: What's the worst piece of software you use everyday? by vin047 on Saturday July 11, 2020 @05:22PM (#23806128)
I’ve yet to find a good intro doc that explains how git works conceptually. There are too few visual examples with authors assuming that users already understand the basic concepts like commits. To people who are completely new to version control, git can appear nonsensical.

Funnily enough I think Atlassian/Bitbucket comes close to a good intro doc to git on their site complete with a visual guide. I still found it inaccessible to people totally new to the basic concepts though.

Re:Ask HN: What's the worst piece of software you use everyday? by ohhhwell on Saturday July 11, 2020 @05:58PM (#23806462)
I've found the git branching game to be quite helpful in building a visual mental model https://learngitbranching.js.org/
Re:Ask HN: What's the worst piece of software you use everyday? by kubanczyk on Saturday July 11, 2020 @07:23PM (#23807095)
No, this one is good (I'd say I regard it as canonical!), but only if you know how commit works on a conceptual level. It is not targeted at absolute beginners.
Re:Ask HN: What's the worst piece of software you use everyday? by tryptophan on Saturday July 11, 2020 @06:58PM (#23806914)
Re:Ask HN: What's the worst piece of software you use everyday? by bacon_waffle on Saturday July 11, 2020 @05:52PM (#23806415)
Re:Ask HN: What's the worst piece of software you use everyday? by dreamcompiler on Saturday July 11, 2020 @10:41PM (#23808285)
Agree with everything in this post except I find stash extremely useful when a pull would disrupt my current working directory. "If I only had a VCS to temporarily hang on to my local changes while I merge the team's."

Stash, pull, stash pop. Done.

(I don't use rebase because I like my history to tell the truth rather than be fictional. Maybe stash is less necessary with rebase; IDK.)

Re:Ask HN: What's the worst piece of software you use everyday? by boring_twenties on Sunday July 12, 2020 @07:26AM (#23810568)
You don't need stash for that though, you can just create a branch.

git branch my_stash git commit -am WIP # instead of stash save git pull git cherry-pick -n WIP git branch -D my_stash

Re:Ask HN: What's the worst piece of software you use everyday? by nemetroid on Sunday July 12, 2020 @09:25AM (#23811141)
You don’t need to create a branch for that though, you can just use stash.
Re:Ask HN: What's the worst piece of software you use everyday? by boring_twenties on Sunday July 12, 2020 @03:22PM (#23813997)
And how is that better?

You have to remember a second command with its own peculiar syntax and semantics, but don't gain any functionality.

Stash is a superfluous misfeature.

Re:Ask HN: What's the worst piece of software you use everyday? by nemetroid on Sunday July 12, 2020 @08:54PM (#23816061)
99% of the time when I use stash, it’s ”stash” or ”stash pop”, usually with ten seconds or so between the two. It’s very easy to remember.

Your alternative, on the other hand, uses an obscure flag to cherry-pick. What scenario would you use that flag for, except this particular one? How is remembering that flag any simpler?

Also, I don’t think your sequence of commands is correct. First, ”git branch” doesn’t switch to the newly created branch, so ”WIP” would be committed on your original branch. Second, the argument to cherry-pick should be a reference to the commit rather than the commit message. I believe a correct version would be:

  git switch -c my_stash
  git commit -am WIP
  git switch -
  git pull
  git cherry-pick -n my_stash
  git branch -D my_stash
Re:Ask HN: What's the worst piece of software you use everyday? by boring_twenties on Monday July 13, 2020 @03:07AM (#23817867)
You are right of course, that my commands weren't correct. Yours are, I'm pretty sure, but I think the following way is better anyway: What I actually do when I want to pull and reapply my local changes is simply `git commit -am WIP && git pull --rebase`. That's it.

I'm don't know now, why I suggested the convoluted temporary branch strategy. Probably because I assumed the GP didn't want the WIP commit, but I guess you could just get rid of it with `git reset HEAD^`. Personally I think WIP commits are way better than having uncommitted changes lying around, and what better time to create one than when you're at the terminal pulling and rebasing anyway? Anyhow.

Now when the rebase fails I can just abort it and be in a very easy to understand state: I have a tracking branch that has diverged from the remote, as `git status` would put it. I find this much better than "my tracking branch says 'up-to-date' but only because my actual changes are in a temporary branch somewhere, or heaven forbid, a stash."

> obscure flag to cherry-pick

Sorry, I'm having a little trouble with this one. What flags aren't obscure then? It's one of the elite 0.01% or so of git command-line options deemed worthy of a short option, so I think it stands to reason that it's rather frequently used.

Personally I used it a lot when I first started using git, before I got the hang of amending and squashing. Almost exactly the same way as I used to use stash, before I realized it was adding negative value. :)

Have you never been in the situation where you pop your stash, have a conflict, fix and commit it and then forget to drop the stash? (pop only drops it automatically if there were no conflicts.)

What if you want to save resolving the conflict for later? Do you just leave it in your stash to have to dig for later (amongst all the redundant leftovers from the preceding paragraph)? Or do you remember to run `git stash branch` at this point, and hopefully don't get interrupted before you can do so? Better, IMO, to just use branches in the first place, instead of this weird out-of-band thing where things are kind of like commits, but not really, and live in a separate place I have to remember to check.

Sorry about the length.

Re:Ask HN: What's the worst piece of software you use everyday? by cben on Friday July 17, 2020 @08:29AM (#23869771)
Behind the scenes, stashes _are_ branches! It's just UI on top of them, optimized for specific use case. You don't have to use it if you don't like it.

Now staging (aka index) is special behind the scenes, making the model more complex for Al users.

Re:Ask HN: What's the worst piece of software you use everyday? by kevsim on Saturday July 11, 2020 @05:02PM (#23805939)
For me personally I find git to be relatively painless (after years of svn and P4). But working with people in less technical roles (PM/UX) who for whatever reason need to touch git occasion, I’m exposed to how inaccessible it is for the uninitiated. Not saying that’s a good reason to change the tool but maybe there’s room in the market for a more accessible tool.
Re:Ask HN: What's the worst piece of software you use everyday? by jerzyt on Saturday July 11, 2020 @08:00PM (#23807327)
I couldn't agree more. The fundamental design it's absolutely brilliant. The UI does take some getting used to.

I frequently use Git as an interview question, but only when the candidate lists Git among the skill set. Specifically, I ask how does Git figure out when you've renamed a file. If you don't grok it, don't list it.

Re:Ask HN: What's the worst piece of software you use everyday? by kuang_eleven on Saturday July 11, 2020 @11:56PM (#23808675)
Almost everyone would agree that listing 'git' as a skill implies knowing the operation of using git, not the specifics of how it works under the hood...

Why ask such a gotcha question?

Re:Ask HN: What's the worst piece of software you use everyday? by jerzyt on Monday July 13, 2020 @12:00AM (#23817021)
I don't think there's anything 'gotcha' about the question. If you understand that git uses SHA1 for the objects it stores, the answer is pretty obvious. If you don't, you really don't know git.
Re:Ask HN: What's the worst piece of software you use everyday? by allarm on Sunday July 12, 2020 @08:36PM (#23815955)
I would say that listing anything as a skill implies knowing of how it works under the hood, until stated otherwise. It’s a resume, not a list of random TIL facts.
Re:Ask HN: What's the worst piece of software you use everyday? by agustamir on Saturday July 11, 2020 @11:07PM (#23808454)
> how does Git figure out when you've renamed a file. If you don't grok it, don't list it.

How does git figure it out?

Re:Ask HN: What's the worst piece of software you use everyday? by Izkata on Sunday July 12, 2020 @03:48PM (#23814216)
Percent similarity on display, not on commit.

That second part is actually important from the user's perspective, not as details on the internals: every single new hire we've gotten who is still learning version control expects svn to detect automatically, and has to be told about "svn mv".

Re:Ask HN: What's the worst piece of software you use everyday? by monkpit on Saturday July 11, 2020 @08:16PM (#23807419)
The ui doesn’t take any getting used to if you don’t use it ;)
Re:Ask HN: What's the worst piece of software you use everyday? by jerzyt on Saturday July 11, 2020 @08:28PM (#23807493)
That is so true. A lot of people use git as write only repository. Still better than nothing, or copying directories. Maybe at some point they'll figure out how to retrieve a previous version.