I have an eclipse wor开发者_如何转开发kspace with directories for various projects:project1, project2 etc. So i created a project1.git in a dropbox folder. I work on my code in project1, my working directory. I have git remote added "project1.git" as origin. So, here is exactly the stupid thing i did.I created a new project, named project2, and without adding a new remote origin for project2, i did a stupid git commit and git push origin. so project1 is now corrupted. How exactly do i recover from this? I mean, i want project1.git to have the current contents of project1 directory. And a fresh project2 folder with a separate project2.git remote origin..
You could just revert the commit in project2 and push again,
git revert HEAD
git push
Don't forget to change origin afterwards :)
精彩评论