Reputation: 4830
EDIT: I have the "git log -p" which seems to show all the changes in a diff mode. Is there anyway to process this log?
Well, I inverted a push and overwrote my active branch with my master. I can't seem to see any way to reverse this damage, either. I've read and tried many options here, and none get back my changes.
What happened:
git add --all
git commit -m "...comments"
git push staging master:alerts
What I should have done was:
git push staging alerts:master
What I did was overwrite alerts with master on my local repository, and the damage seems to be done. I studied and tried recommendations both in the git guides and here on SO without success.
I have tried various versions of commands such as git revert; git reset, etc. The current hash/HEAD@{0} had none of my recent changes and the old hash/HEAD@{1} was even older. All changes to my current branch seem to be irretrievably lost, overwritten by master.
It puzzles me that such a simple mistake could do this without warning or recourse. I thought git protected me... Any advice?
Upvotes: 1
Views: 59
Reputation: 4830
Well, so far, I am working on using the patch process.
The patch log was created by:
git format-patch master --stdout > my.patch
Move my.patch to another directory temporarily, then:
git checkout master
Move it back, then these commands should apply it:
git apply --stat my.patch
git apply --check my.patch
git apply --apply my.patch
Instead of the last command, you can signoff on the patch using:
git am --signoff < my.patch
I am checking on the success...
This all comes from: How to create and apply a patch with git
Upvotes: 0
Reputation: 8715
As long as you didn't do forced push no commits were lost. So there was nothing git should have warned you about. If you don't see you recent changes done to local alerts then you have either done something else destructive or don't look properly. You may always use 'git reflog' to recover recent local commits.
Upvotes: 1