Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I lost my uncommited changes after I made a merge

I am new in git and I got all my changes lost.

I made a branch for my changes, and then I wanted to make a merge.

So i switched to master and merge my branch with master, but I forgot to make a commit. So now my branch looks like the same as master.

Made the merge with GitHub client for Mac, it didn't throw any errors...

How can I restore my uncommitted changes?

Here's the history of my terminal. But all these were typed after I've found out that my changes were lost and tried to google the answer.

506 git checkout master

507 git merge storyboard_branch

508 git reflog

509 git reset --hard HEAD~1

510 git reset --hard HEAD~0

511 git reflog

512 git reset --hard HEAD~1

513 git reset --hard HEAD@1

514 git reset --hard HEAD^@1

515 git reset --hard ^HEAD@1

516 git reset --merge HEAD~1

517 git reflog

518 git reset --merge HEAD~5

519 git reset --merge HEAD~7

520 git reset --merge HEAD~7

521 git reflog

522 git reset --merge HEAD~14

523 git reset --merge HEAD~14

524 git commit -c ORIG_HEAD

525 ды

526 ls

527 cd .git

528 ls

529 grep -ri stroyboard_branch

530 cd ..

531 git checkout

532 git checkout storyboard_branch

533 git pull origin

534 git checkout storyboard_branch

535 git reflog

536 git reset --merge HEAD~22

537 git checkout

538 git commit -c HEAD~16

539 git reset --merge

540 git reset --merge

541 git reflog

like image 986
haik.ampardjian Avatar asked Nov 13 '22 01:11

haik.ampardjian


1 Answers

If you haven't committed the changes and you checked out another branch git will not store the files it will overwrite them with the branch you specified.

This being said there is NO way to recover the lost data, except if you used git stash beforehand.

Commit Early, Commit Often

like image 69
Krotz Avatar answered Nov 15 '22 05:11

Krotz