Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub for Mac Commit & Sync has overwritten local files How can I revert

I used 'Commit & Sync' and for a brief moment the 'Merge Conflics' dialog popped up just like VonC described here. Next all my local files have been overwritten. But there is now record in the history and also not if I run git reflog show

How can I revert this sync and get back my up to date local files?

Any ideas?

like image 264
dataitalia Avatar asked Feb 18 '26 08:02

dataitalia


1 Answers

Your changes are probably being stashed (git stash). For some reason Github on Mac stashes any local changes so it can pull down changes from the remote repo (even though it misleadingly states that it hasn't done anything because it would overwrite changes).

WARNING: I would make a backup of your directory before trying any of the following in case something goes wrong.

Open a terminal in your repo's directory and type git stash list. You should see an entry like stash@{0}: GitHub: Stashing to pull in remote changes. If you type git stash show stash@{0} it will display a list of files with all of the changes you had before.

To restore those changes, type git stash apply stash@{0} and it will write those changes to your directory (possibly overwriting changes you pulled from your remote repo). You can also use git stash pop @stash{0} to retrieve the code and delete the stash immediately after, but I'd hold on to it until you're sure you don't need it.

like image 155
David Avatar answered Feb 21 '26 13:02

David



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!