News for hackers. Stuff that matters.
Re:Ask HN: Is it me or Git rebase is kind of hard to underst... by savg on Friday December 16, 2022 @09:28AM (#34014813)
I'm the opposite and think rebasing is easier, but I am biased obviously since I have only used rebasing to solve merge conflicts.

There are a couple ways of performing a git rebase, namely

* git rebase

* git rebase interactive (git rebase -i)

* git rebase --onto

I think following these videos may help and will explain it better than I can.

What is Git Rebase? [Intermediate Git Tutorial] - https://www.youtube.com/watch?v=_UZEXUrj-Ds

Squashing Git commits with Interactive Rebase -https://www.youtube.com/watch?v=7IfkL8swmFw

How to undo git rebase using git reflog. - https://www.youtube.com/watch?v=qP4i3S2hujc&t=203s

Re:Ask HN: Is it me or Git rebase is kind of hard to underst... by Akcium on Friday December 16, 2022 @09:39AM (#34014946)
I know little about git rebase, but the situation that just happened is kind of weird.

I was working on my branch as usual. Today I checked git status and found out that I'm in the process of rebase. I was afraid a little, and decided to abort it.

I lost my changes.

When to git reflog, saw tons of commits, tried to cherry pick the one that has my changes.

Now, I have my branch with my changes. But. If I pull from origin, I lost them. If I push force the branch, I'll erase other devs changes.

It's so confusing =(

Re:Ask HN: Is it me or Git rebase is kind of hard to underst... by seba_dos1 on Friday December 16, 2022 @10:11AM (#34015378)
Just checkout (not cherry pick) the last commit from your reflog and point your branch to it and you'll be back exactly where you started. "git rebase --abort" simply did a checkout and pointed your branch to a place from before you started rebasing (that you apparently forgot about), you haven't lost anything.