I checked out another branch with updates then made a few changes, switched back to the main git and now the changes disappeared! Can I get them back? the terminal was basically:
$ git commit [detached HEAD 7c09e17] Fixed some stuff files changed, insertions(+), deletions(-) $ git push master fatal: 'master' does not appear to be a git repository fatal: The remote end hung up unexpectedly $ git checkout master Previous HEAD position was 7c09e17... Fixed some stuff Switched to branch 'master' $ git merge theother/directory
It just means you are not currently attached to any branch, and as a result, your HEAD is detached. If you want to keep the changes you made while in the detached HEAD state, you can solve this problem with three simple steps: creating a new branch, committing the changes, and merging the changes.
To view the previous commits, use the git log –-oneline command. This provides the commit details.
Assuming you're still on master:
git merge 7c09e17
should be enough. git
is usually good about telling you the commit IDs, if you watch the terminal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With