Live data from Hacker News

New in Git: switch and restore

banterly.net

161–170 of 550 posts

Re: New in Git: switch and restore

#161

Earlier quoted context omitted.

I wouldn't say I'm an expert but I've got about 10 years experience using git via CLI and whenever a noob does something weird and he's using an IDE I'm like... Sorry I have zero idea what this is trying to do and cannot help you

I have 10 years of git cli and I use GitHub desktop or Sourcetree most of the time. I started using using a git IDE to help support the team members that weren’t experienced in git that chose to use one. I work in games and a lot of game developers mostly know Perforce. I would never brush off a team member with “cannot help you”. I’m a git expert and I will figure out what’s wrong and fix it.

But are you an expert in the IDE? Are they having a problem with git or are they having a problem with the IDE?

Re: New in Git: switch and restore

#162
post #105

Earlier quoted context omitted.

We are all using git only because Linus wrote it. The cargo cult is real and very much alive in our industry, I think precisely because we are all here to write specialist software. Too busy in our domain to worry about version control nuances so we just go with what is popular and don't think about it too much. It's not just version control, it's libraries, frameworks, languages, all of it. If it's not popular it's…

You assume that the creator of one of the.. if not the largest open source projects on the planet might not understand the issue at hand better than literally anyone? That seems arrogant. I imagine more thought & care went into git than you can fathom.

If "the issue at hand" is running a globe-spanning open-source project with hundreds of contributors, a bunch of targets, and a code base that goes back 30 years, sure, I'm happy to listen to Torvalds.

if "the issue at hand" is the more typical modern work environment for devleopers, then no, I don't think he has much special insight. Indeed, the fact that he's wrangling something so large and important means he's unlikely to have the time and attention to devote a lot of thought to how best to serve a pretty different group of people.

An obvious consequence of this is git's terrible interface. Its premise is "if you totally understand what Git is up to under the hood, the interface is great!" Fine for a small in-group of kernel developers whose lives are distributed patch sets, but terrible for the average developer. It has taken 15 years to get some reasonably named commands for common things like "restore a file". That's a great sign that we shouldn't listen to Torvalds on topics outside the realm of his admittedly impressive expertise.

Re: New in Git: switch and restore

#163
git reset HEAD --hard or if it doesn't want to do it, I checkout another branch delete the old one and checkout back then use the local history from Jetbrain's IDE is my way to go. Probably not best practice but fast and efficient.

Re: New in Git: switch and restore

#164

I used to know lot of terminal commands but I'm seriously falling behind due to jetbrains integration which covers 99% of my daily use case. Together with local history, I've never "lost" work in years. Never heard of switch /restore and will probably forget about it the next time I'm on the terminal. Rebase and interactive Rebase is so well integrated for my use cases and I feel much more productive without having t…

My conflict resolution skills have atrophied due to jetbrains. It’s just so much easier than anything else I’ve tried. Even when I don’t already have a project opened in idea, I’ll open it just to resolve a merge conflict.

The rest I do on the command line because I don’t want to forget — except commits because I’m not at risk of forgetting “git commit -m”.

Re: New in Git: switch and restore

#165

A lot of comments along the lines of ‘why do people use instead of learning the commands’. For me, I used to use the terminal git, and I still do occasionally. But I use Sourcetree now for most things because I make less mistakes seeing the tree visually all the time. My job isn’t to use git, it’s to write specialist software. If I get the software written and the customer is happy, it doesn’t matter whether I use or…

I wouldn't say I'm an expert but I've got about 10 years experience using git via CLI and whenever a noob does something weird and he's using an IDE I'm like... Sorry I have zero idea what this is trying to do and cannot help you

First of all, using "noob" like that is offensive. Everyone's a "noob" at some point. And if that's how you talk and treat people, I probably wouldn't want your help.

And second, what exactly mystifies you about what e.g. SourceTree menu commands do? They map clearly and intuitively to CLI commands.

If you have "no idea" what it's trying to do then you're not even trying to be helpful. You're just being condescending.

Re: New in Git: switch and restore

#166
post #105

Earlier quoted context omitted.

We are all using git only because Linus wrote it. The cargo cult is real and very much alive in our industry, I think precisely because we are all here to write specialist software. Too busy in our domain to worry about version control nuances so we just go with what is popular and don't think about it too much. It's not just version control, it's libraries, frameworks, languages, all of it. If it's not popular it's…

You assume that the creator of one of the.. if not the largest open source projects on the planet might not understand the issue at hand better than literally anyone? That seems arrogant. I imagine more thought & care went into git than you can fathom.

This isn't about "understanding the issue at hand," this is about UX development.

Linux is, very intentionally, a piece of software which does not have "easy to understand for non-experts" in its design goals. You generally interface through Linux with system call wrappers provided by a libc (or another specialist library for other interfaces like libfuse or libnetfilter or whatever), not directly. Linus is, quite obviously, good at many things; it's silly to assume that means he's an expert at everything.

Linus developed Git as a low-level tool. Linus put a lot of thought and care into getting the implementation details right, but intentionally did not build an easy-to-use interface. The Git command line that people use today ultimately derives from Cogito, a toolkit written by someone not Linus that sat on top of Git. Eventually Git (which Linus had long since handed off to someone else) adopted most of the conventions of Cogito and created a "porcelain"/"plumbing" split. If you think it was arrogant to develop Cogito, I suspect you disagree with Linus.

Finally, Linus develops Linux with a very particular model, with e-mail-based patch reviews, merges from subsystem maintainers, etc. Most projects (even most open-source projects, but certainly almost all proprietary projects) do not work this way. The Linux kernel does not use a GitHub-style workflow for development, which is by far the most common way people outside the kernel community use Git. It may well be the case that a lot of thought was put into making Git work really well for Linus's use case but it does not match how other people do development.

Re: New in Git: switch and restore

#167
post #71
post #60

Earlier quoted context omitted.

Complexity is like body odor: you generally don't mind your own.

Git has not been Linus's project for many years.

Analogy still applies, though. If a room is smelly to you, you aren't going to hang around. So the people who spend time there are going to be ones comfortable with the funk.

Re: New in Git: switch and restore

#168
post #4

You don't need -- as much in the "git restore" example. With git checkout it may be necessary to separate the branch and the paths with "--" but since "git restore" does not take a branch (except with -s), doing this is totally fine git restore test.txt

Thank you very much for this info.

From the article, I was thinking that it was again a stupid confusing design for the cli to requires the -- even with a dedicated command.

One main issue with git is to not be consistent and logic with the comments. Always to use different way or option abbreviation for different command. For example having a space or a slash between repo and a branch in a command.

Re: New in Git: switch and restore

#169
post #82

Earlier quoted context omitted.

All visual git tools I've used suck and wound up eventually corrupting the repo. Also I've noticed that all of my colleagues who learned git using these visual tools didn't actually learn git, and have no idea how to anything other than add/commit/push. I say "just rebase your branch" and I can see the panic grow in their eyes.

> I say "just rebase your branch" and I can see the panic grow in their eyes. The irony of that is that resolving conflicts in a complicated multi-commit rebase is much more easily/efficiently done in a good GUI than on the command line. Not all GUIs support it though (I think SourceTree gives up if there's a conflict), in fact it's a bit of an acid test for a Git GUI. The Jetbrains IDEs (PyCharm, CLion, IDEA, etc.)…

Sublime Merge’s three-way merge is so good. It’s totally spoiled me.

Re: New in Git: switch and restore

#170

Earlier quoted context omitted.

So send in a patch.

I don’t know why this is getting downvoted. It’s the correct solution and actually a great opportunity to make an easy contribution to open source.

It's not the correct solution because it requires knowledge of the intent of the project leaders, which is not easily available to us.

A much better response would be, "Thanks for pointing that out! I have filed an issue." One can't simultaneously through shade for not being community-spirited while expecting other people to do all the work.

Post reply on HN