I'm new to git and I've made a couple of commits to local repo. Then by mistake I clicked 'Pull' instead of 'Push'. In the end I starded to cleaning my desktop... I removed a whole directory (repo clone). After cloning repo from server there wasn't any of my commits.
Could you tell me please is it possible to restore removed repo (changes开发者_StackOverflow社区)? I'm using Windows 7 + TortoiseGit.
Thanks in advance.
Are you backing up your local machine? If not, when will you start?
Here's the bottom line: if you have changes in your local repo that you don't push, and then you delete that repo, the fact that your changes were once in a source control system can't help you.
Response to comment:
I'm not surprised that you have been using SVN (cvs-isch). It's essential that you learn the difference between commit and commit. In git you only commit locally and use the push/pull mechanism to synchronize different repositories that have diverged from each other.
The commit in git can be looked as some form of cached commit in SVN, you queue up your changes for a later synchronization. The actual sync is delayed. A lot of people at work still have problems getting the difference
Original answer:
Version control is not a cure for stupidity ;) The only thing you can do is to try and recover data from the hard drive by hiring someone that can reconstruct data that has been lost.
You committed to your local repository, not the server. If you deleted that repository, there's no way to get the commits back from a repository you didn't commit to. Version control can only do so much...
Just so you know for next time, you probably wanted something like git reset --hard @{1}
to put your local repository back to the state it was before the accidental pull.
精彩评论