开发者

How do you sync to a prior changelist in GitHub?

I come from the Perforce world, so my language here is going to be Perforce speak, but I am trying to use GitHUB and something terrible has happened. I used the commands:

git reset --hard
(and)
git clean -f -x -d
(and then)
git fetch

to attempt to revert some code I had just written.

Instead of reverting my code, all that hap开发者_运维技巧pened to me was all of my files that were modified got deleted off the server AND off my local machine.

Unfortunately most of my code was in a single source file, and since I had modified that file it has vanished from existence, both off the server AND off my local machine.

Could someone please give me the GitHub command to sync to an older revision of the code? I'm afraid this is the only way I'm going to get my source code back...!

Does anyone know what I have done wrong here?

Thanks -Simon


Nothing should have happened on the server with the commands you listed. Even if you pushed a change you didn't want (e.g., one that deleted a file), all the history should have been preserved on the server.

Have you tried simply cloning the repository again? That might be the simplest way to ensure that your local git clone is in a sane state. After that, look through the log for the file.

If it's still not there, you must have done more than you indicated in your original question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜