Follow

Did you know that "git checkout -" works much like "cd -" and switches back and forth between two branches?

You're welcome.

@fribbledom daaang I’ve been using reflog to look it up all this time, thank you!

@fribbledom That was definitely added after Git 2.12.0...

"error: pathspec '-' did not match any file(s) known to git."

@fribbledom whaaa thank you for posting this!
I had no idea

@tfb @fribbledom As I said last week after sitting down with a user to help them make git do what they wanted it to do, and filling a bunch of gaps in their git knowledge:

"On behalf of the universe that produced it, I apologize for git".
@fribbledom @tfb I mean, what did you expect exactly? What isn't a UI shitshow in your view?
@hypolite @fribbledom @tfb Any other VCS than git except baz and clearcase is generally less of a UI shitshow.
@hypolite @fribbledom @tfb Correction: By "baz" I mean "GNU arch" or "tla". I don't actually know what "baz" looked like. It was supposed to be an improvement over tla/arch, and perhaps it was (bzr was built off the lessons from baz), I just mixed them up just now.
@clacke @fribbledom @tfb How so? CVS wasn't great for me, neither Subversion. No matter the software, you will have to learn how it works and the commands it reacts to. Git is the first VCS that I used where when you do something wrong, it actually suggests how to come back to a stable situation. I've had to delete/re-clone more Subversion repositories than Git's for example.
@hypolite @fribbledom @tfb As a technical tool git is the superior VCS, hands down. But the UI really is dreadfully inconsistent. Terminology jumps around. Abstraction level jumps around. Every single command is an organic historical accident with no unifying metaphor other than the underlying content store.

I have internalized it all and mix plumbing and porcelain commands like a madman, but when I have to explain to a non-poweruser why something went wrong for them, time and time again I discover that I have to give them a lecture on weirdness to give them the background to understand why they didn't do what they thought they did.

This is unique to git. svn isn't like this, bzr isn't like this, I hear hg and monotone aren't like this. The explanation is probably that worse is better.

git is like English. We can explain why it turned out the way it did, and it is a tool used to great effect by lots of people, but if we could ignore network effects and cultural inertia it really would benefit from a major remake.

@clacke @hypolite @fribbledom It's much worse than "worse is better". Hg existed first, and was used by Linux. Instead of replacing its backend with their cool new idea for a DCVS storage model, the Linux kernel group decided to get NIHy and bless the world with one of their amazing interfaces.

It won due to the momentum of the kernel group, then GitHub.

@tfb @hypolite @fribbledom I don't know if worse is better or NIH best describes "I'm just gonna bang this out in a weekend and I don't have time to look at your stuff", but I guess it's a bit of both.

WIB is what explains why git won. It appeared in the right place, associated with the right people, solved the right problem just well enough, and built from there with minimal incremental changes chasing local maxima.

* Not Invented Here

@clacke @hypolite @fribbledom I just don't think WIB quite describes what happened there, as hg was also in the right place at the right time with the right group if people. Just, Torvalds made git, so despite being significantly less user friendly, they went with that.

"Invented Here is Worse therefore Better" I guess 😛

@fribbledom too bad you can't pushb/popb a branch or two though. Although I am just noticing a risk of using 'push'

@julienxx @fribbledom Wow, if this is true I am going to have so much use for it.

@clacke @julienxx @fribbledom Well, shit. I didn't even know about `cd -`! Here I've been using `pushd` and `popd` like a fool.

@fribbledom you've saved me about five minutes a day. Thanks!

@fribbledom I didn't even know about "cd -", I always used pushd and popd. Which doesn't quite do the same job.

@fribbledom
Who needs branches if you just clone the repo and actually use cd

@julian @fribbledom Not when you're working with a 600 MB git repo over a 20 Mbps link. git checkout and git worktree are saviors.

@fribbledom you mean to tell me that I've been a UNIX and Linux user for 27 years now, and I never knew about `cd -` ????

@twylo

I'm confused how often I've seen that kind of response now 😆 I don't think I would have made it through all those years without it.

Sign in to participate in the conversation
Mastodon

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!