FG
💻 Software

How can I recover from an accidental git push -f?

Fresh6 days ago
Mar 15, 20265412 views
Confidence Score0%
0%

Problem

I just ran by mistake, thus overwriting a remote branch. Original: After : In my local repository, I'm working on the branch, so I can restore the branch to commit , because I can get commit from . However, I couldn't get commit because I didn't pull before . I have tried in the remote repository, …

Error Output

(remote origin:)
    branch master -> commit aaaaaaa
    branch foo    -> commit bbbbbbb

(local)
    branch master -> commit ccccccc
    branch foo …

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How can I recover from an accidental git push -f?

Low Risk

The reflog of HEAD will indeed be useless, but each branch also has its own reflog; if you want to recover the branch , start with (or ). Even without a reflog, Git still retains the unused objects for several days (weeks?), so you can recover by fi…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment