DEV Community

Cover image for git rebase, ๐Ÿ˜Ž --> ๐Ÿ˜ฑ
Rishi
Rishi

Posted on

10 2

git rebase, ๐Ÿ˜Ž --> ๐Ÿ˜ฑ

You keyed in git rebase , and pressed Enter like a ๐Ÿ˜Ž.

Then everything looks ...๐Ÿ”ฅ... not exactly the same as you expected it.
๐Ÿ’ you realised that you didn't push โ›… any of your recent work and you're at a point of no return! ๐Ÿ’จ

๐Ÿ˜ฎ

๐Ÿ˜จ

๐Ÿ˜ฑ

๐Ÿ˜ฐ

๐Ÿ˜ฉ

๐Ÿ™ˆ

PANIC


๐Ÿ’ก

Here's a solution

Use git reflog - Manage reflog information.

  1. In the terminal, type in git reflog.
    You'll see a list of all recent commits.

  2. Pick the one which you worked last.
    In my case, commit 29b5617 was the one I needed to go back to.
    git reset --hard 29b5617

    Alternatively, git reset --hard HEAD@{17} would have worked exactly the same.


Let the rest know how you've survived an unwanted git rebase by leaving a comment.

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (1)

Collapse
 
icaruscomplexz profile image
icarusComplexz โ€ข

Oh my god did I need this earlier today.

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs