Github Desktop 2.9.4 -> Auto Rebase Triggered - Commits Lost? #24070
-
Hi Everyone, So I’ve a repo with a main & feature branch and I’m working (solo) exclusively in the feature branch. I’ve been using GHD 2.9.3 and this morning completed a set of changes, most of which were then committed locally (to be pushed to origin at the end of the day) After committing locally, I noticed a prompt saying 2.9.4 had installed, so re-started to update. After restarting, I was automatically prompted with a dialog referring to a rebase… Now I never triggered this. I always use Squash & Merge into the main branch and never have reason to Rebase. On-top of this, I don’t understand how a conflict can occur in a feature branch that only I work on and is always ahead of main. After clicking abort, GHD reverted back to a point in July and all changes since then appear lost. Pull origin is showing 198 deltas, which I assume are the commits since July. Which hopefully means they’re still in the local repo, but somehow hidden (the local repo shows no stashed changes) After speaking to a friend who is far more of expert on GH than myself, he suspects I just need to move the head back to the last commit. Could it be related to this… Merge dialog auto closes after conflicts are resolved · Issue #12881 · desktop/desktop (github.com) Which in-turn references this… Any help would be greatly appreciated! Kind regards, David |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
Hi Steve, Ok, I’ve copied the relevant portion of the logs (at the bottom) and redacted personal info. This is what happened…
Hopefully this helps, but if not I also have some screenshots of a reflog that might shed some light on things. Log from point of first opening GHD to realising there was an issue… 2021-10-06T12:53:09.083Z - info: [ui] [AppStore] loading 2 repositories from store |
Beta Was this translation helpful? Give feedback.
-
Hi Steve, Happy to send the log, but is there a way of sending it privately as it does contain personal info? Kind regards |
Beta Was this translation helpful? Give feedback.
-
👋 @peachypixels I work on the GitHub Desktop team – would you be willing to share your log file so that I could take a look at what might have happened here? To access the log files go to the file menu in GitHub Desktop and select The log files are created daily – please upload a log file as an attachment from a day where you experienced the issue. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Thank you! @airtower-luna That worked perfectly! I zipped up the local repo as soon as it happened, so had a fresh copy. So after unzippping the backup, I did the following…
Et voila! My repo is back in the state it should have been in the first place. I honestly do not know what happened. The update to 2.9.4 seemed to trigger this and it kept reverting to a state two months ago, but I do not know why. The commit it was reverting to did show something around that time, specifically… checkout: moving from (commit id) to (feature-branch) I don’t recall ever doing a Rebase, although do have recollections of reverting a change at around that time. Who knows! Anyway, thank you again! It’s hugely appreciated :slight_smile: Kind regards |
Beta Was this translation helpful? Give feedback.
-
If you The easiest way to fix the branch and get out of detached HEAD state is to check out the branch, and then reset it to the correct commit. Double check there aren’t any changes in the working tree that you want to keep before using
|
Beta Was this translation helpful? Give feedback.
-
Quick update… So I used… git reflog And determined that the head was not where it should be. This mornings commits were showing however, so I used the following to move the head to the last known commit… git checkout [hash] Then finally… git reset --hard HEAD Now on opening Github Desktop my commits are back in the history tab (great!) but the branch is still showing as detached, which I understand it should not be? On-top of that, if I switch to the feature branch this mornings commits once again disappear. |
Beta Was this translation helpful? Give feedback.
If you
git checkout
a commit by its hash Git goes into “detached HEAD” state, where you aren’t on any branch at all. That’s also why your feature branch is unchanged: You didn’t reset that branch, you just checked out a commit and reset your working tree to that state.The easiest way to fix the branch and get out of detached HEAD state is to check out the branch, and then reset it to the correct commit. Double check there aren’t any changes in the working tree that you want to keep before using⚠️
git reset --hard
.See:
git reset [<mode>] [<commit>]