Git 吉特,怎么回去?
我做了这些手术:Git 吉特,怎么回去?,git,heroku,github,Git,Heroku,Github,我做了这些手术: $ bundle exec rspec spec/ $ git add . $ git commit -m "Finished layout and routes" $ git checkout master $ git merge filling-in-layout $ git push $ git push heroku 但后来我发现程序搞砸了。我想回到上一次。本地和github以及heroku。我该怎么做?在您的所有分支中,键入 git reset --hard HE
$ bundle exec rspec spec/
$ git add .
$ git commit -m "Finished layout and routes"
$ git checkout master
$ git merge filling-in-layout
$ git push
$ git push heroku
但后来我发现程序搞砸了。我想回到上一次。本地和github以及heroku。我该怎么做?在您的所有分支中,键入
git reset --hard HEAD^
这将重置并放弃对上次提交的所有更改
如果不想在错误提交中放弃更改,可以使用
git reset --mixed HEAD^
假设
master
和filling-in-layout
都是您接触的分支:
# Reset master to its previous commit
git checkout master
git reset --hard master@{1}
# Reset filling-in-layout to its previous commit
git checkout filling-in-layout
git reset --hard filling-in-layout@{1}
# Push to GitHub, forcing the loss of history
git push --force
# Same, for the heroku remote
git push --force heroku