Live data from Hacker News

Oh Shit, Git?

ohshitgit.com

61–70 of 275 posts

Re: Oh Shit, Git?

#61
post #34
post #4

Git is one of those technologies that I never got to wrap my head around of, because in so many ways it doesn't follow intuition and unless you have been using it for a long time, for literally every action you would probably have to Google or use the man page of the command.

As everyone knows, though, Git gets easier once you understand branches are homeomorphic endofunctors mapping submanifolds of a Hilbert space.

> homeomorphic endofunctors mapping submanifolds of a Hilbert space

Has to be easier to understand that then all the arbitrary git commands.

Re: Oh Shit, Git?

#62
post #33

Earlier quoted context omitted.

I prefer just using `git switch` because it's easy to remember the flags (and the position of arguments), but you're right, there is a simpler way: git switch -c some-new-branch-name git branch -f master HEAD~

You should also be able to do git branch -f master origin/master

This doesn't work if your local master was already ahead of origin

Re: Oh Shit, Git?

#63
post #62

Earlier quoted context omitted.

You should also be able to do git branch -f master origin/master

This doesn't work if your local master was already ahead of origin

Indeed, as with all of these examples exceptions will apply and, it's a good idea to check the log before taking any such action. I believe your example also depends on exactly how many commits you've made that need to be moved. In any case, it depends on me remembering exactly what `~` signifies.

Re: Oh Shit, Git?

#67

Lately I've been asked to avoid merge-commits. They pollute the logs? If my push is blocked I am too far behind I create a new temp branch of master and do a "merge --squash" to it and then a "reset --hard" from temp branch back to my original branch. Heck sometimes I rather keep my changes in patches to void does darn merge CONFLICTS...specially when rebasing.

Hard to understand exactly what your issue is here. Typically when people say "avoid merge commits" they mean they want you to almost always rebase instead of merge. Can you give an example or something?

Re: Oh Shit, Git?

#69
post #7

Earlier quoted context omitted.

We’re not all working at $bigcorp with dedicated help teams. Sites like this are great and have helped me many times!

OK, so you've truly screwed up your your personal/small-team repos to the point of requiring poorly-understood command sequences from the Notoriously Reliable Internet more than once? I applaud you for your honesty, but... Really?

Yes. I think the ratio of small-team repos this describes is close to 100%. You seem to have a certain idea of how repos are managed. I don't think it's very representative of reality.
Post reply on HN