git 撤销最后一次提交_Git撤消上一次提交

git 撤销最后一次提交

I'm a massive fan of git; it's super powerful and easy to use, especially when it comes to branching.  The biggest sin I commit when using git is adding files and then committing them...to master branch instead of a feature branch.  Oops.  Certainly don't want that.

我是git的忠实粉丝; 它超级强大且易于使用,尤其是在分支方面。 使用git时,我犯下的最大罪过是添加文件,然后将它们提交到master分支而不是feature分支。 哎呀。 当然不想要。

If you've done a git add (files) and then commit them to the wrong branch, backing that out is easy:

如果您已经执行了git add (files) ,然后将它们提交到错误的分支,则备份起来很容易:

git reset --soft HEAD~1

With the command above, the files are still added but not committed, so you can create your feature branch, do another git commit -m (message), and be on your way!

使用上面的命令,文件仍会添加但尚未提交,因此您可以创建功能分支,再执行git commit -m (message) ,然后就可以了!

翻译自: https://davidwalsh.name/git-undo-commit

git 撤销最后一次提交

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值