Live data from Hacker News

Oh Shit, Git?

ohshitgit.com

261–270 of 275 posts

Re: Oh Shit, Git?

#261

Earlier quoted context omitted.

If you `jj undo` a second time, does it redo (undoing the undo), or does it back up another step?

It redos, there's discussion about if and how this should change: https://github.com/jj-vcs/jj/issues/3700

For background, this is because the `undo` itself is an operation pushed onto the top of the stack. It is a little counterintuitive.

Re: Oh Shit, Git?

#262

Earlier quoted context omitted.

>> You can address women as "bro" and they might even respond to you but they'll think you're absolutely weird. >I'm about 95% sure that if I ask my two school-age daughters if it's weird to address girls and women as "bro" or "bruh" I'm 100% sure I said women , and not "school-age" girls, who if they weren't your daughters would probably describe you as "creep" because that's what teenage girls do. But sure, go ahea…

[flagged]

Sorry, NO. Women are women, girls are girls, "bros" are "bros", and trolls are trolls. I know which one you are.

Re: Oh Shit, Git?

#263

We should start recommending UIs as the default way to learn Git. It would solve a third of these problems and another third wouldn't even come up. If you later decide that the CLI is faster, go ahead. But first, people need to see visually how they can interact with the tree. I like fork.dev, but most clients are pretty similar at this point.

If git had a visualization command a la [1] built in, that'd suffice. Nothing wrong with asking devs to use a CLI tool, but asking them to edit a DAG without a picture is like demanding they edit a file with ed.

[1]: https://stackoverflow.com/questions/1838873/visualizing-bran...

Re: Oh Shit, Git?

#264

We should start recommending UIs as the default way to learn Git. It would solve a third of these problems and another third wouldn't even come up. If you later decide that the CLI is faster, go ahead. But first, people need to see visually how they can interact with the tree. I like fork.dev, but most clients are pretty similar at this point.

disagree, with a caveat. to summarise: use the desktop apps now, but thou shalt need to learn the CLI. — when i’ve taught absolute development beginners how to use git and how to do PRs i show them both the CLI and GitHub desktop. not every single thing. but i at least show them add/commit/push and creating/checking out branches in the CLI. why? 1) this CLI thing is what power users / experienced folks use. this is y…

I wish GitHub desktop would include a quake-style console for quickly accessing git commands for the open repo as an escape hatch. Ctrl+backtick works fine for my use but it’s hidden, it would be more conducive for learning if it’s a tab or just an addressbar-esq inputbox.

Re: Oh Shit, Git?

#265

This will feel very weird in April 2025, when we celebrate the 20th anniversary of git. I was there. And at some point I wondered if I should learn git, darcs, or bazaar, to replace SVN or CVS. Or did I try mercurial too ? I wonder if the "GitHub" effect has basically killed the need for a newcomer in the space of VCS. Maybe at some point, the yak is shaved enough ?

SVN has always worked for me. You don’t have to “teach” people SVN because it’s intuitive and works just fine for the 99% case. I wish we would all stop larping as 1337 hackerz and just admit that git is overkill for the vast majority of people.

Another anecdotal data point : I wasted a lot of time trying to figure out SVN too. I think I was using TortoiseSVN FWIW but basically gave up on my two person project

Re: Oh Shit, Git?

#266
post #131
post #3

Some changes I would make: 1. Always use `git switch` instead of `git checkout` 2. Avoid `reset --hard` at all costs. So for the "accidentally committed something to master that should have been on a brand new branch" issue, I would do this instead: # create a new branch from the current state of master git branch some-new-branch-name # switch to the previous commit git switch -d HEAD~ # overwrite master branch to th…

> 1. Always use `git switch` instead of `git checkout` Even harder: always use "git reset --hard". Basically don't use local branches. The correct workflow for almost every task these days is "all branches are remote". Fetch from remotes. Reset to whatever remote branch you want to work above. Do your work. Push back to a remote branch (usually a pull request branch in common usage) when you're done. If you need to m…

That's my approach and I've never seen anyone else doing it. Many years ago I lost my local changes, I don't even remember why. HDD failure or something like that. Ever since, at the end of the work day, I just commit "m" or "WIP" or something more meaningful, but I get it out before closing my laptop. Then, once I'm done with the the draft PR, I fetch the latest changes, reset hard and write a nice story with commits. This way I don't ever lose my changes, I can write a nice git history and I can iterate over the changes fast.

Re: Oh Shit, Git?

#267

Earlier quoted context omitted.

>I struggle to understand why so many devs decide to treat it like mysterious arcane sorcery instead of just spending the needed time on learning how it works. For example: you have bazilion ways to achieve the same thing, all of them having its own quirks/advantages? It is just poorly designed, that's it, lol. I like to joke that if somebody else invented Git, then it'd be 10% less powerful, but 10 times more user-f…

But any software evolves over time so if it had fewer ways of doing things in the past, it would very likely eventually pick them up because people have use cases for the advanced features. It's like complaining about languages ("English is hard to spell and doesn't have consistent pronunciation" etc.), they're constantly changing and that kind of thing is going to happen eventually...

We're talking about achieving the same/similar things in various ways.

There's difference between adding advanced features well and poorly.

Re: Oh Shit, Git?

#268

Earlier quoted context omitted.

The "move a branch" command is `git push .`. Yes, you can push to the current repo. I have a script called git-update-branch which just does some preflight checks and then runs `git push --no-verify . +$branch@{upstream}:$branch` to reset a branch back to its upstream version.

> The "move a branch" command is `git push .`. Yes, you can push to the current repo. Wouldn't that copy a branch rather than moving it?

"move a branch" means changing the commit the branch points to. `git push . $sha:$branch` will update $branch to point to $sha (you'll probably want to force this, unless you're just fast-forwarding the branch).

Re: Oh Shit, Git?

#270

Earlier quoted context omitted.

You are looking for git update-ref

Wouldn't the fail or break under any circumstance where they don't immediately share a history?

I just tested it by creating a repo with two branches without a common ancestor, and I was able to move a branch pointer to either history with update-ref, so no, I don't think so
Post reply on HN