简体   繁体   中英

New file lost after git stash and then git stash apply in new branch

I've probably just lost 5 hours of work here... :(

I was on branch A: Created new file with other changes to existing files

I stashed my changes

Checked out master

Did pull on master

Checked out branch A

Did git stash apply

Did git checkout -b newBranchB

I then did git rebase master

Due to some conflicts I then did git rebase --abort

Prior to aborting and rebasing, I can see the new file.

I don't see my new file after aborting rebase! :(

see if git reflog has it.

git log records all commits that will be pushed to the remote repo.

get reflog shows all commits, even squashed commits - amended commits, overwritten commits, etc (but only since u last cloned).

git reflog

git reset --hard YOUR_REFLOG_COMMIT

i just hope u committed at some point!

note that git reflog is a local reference and is deleted if you delete the git folder locally. unlike git log, which will be available if you delete the git folder locally and then clone the repo again later.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM