【问题标题】:How to reset to any of the previous commit in android studio?如何重置到 android studio 中的任何先前提交?
【发布时间】:2016-05-07 15:23:37
【问题描述】:

我从 android studio 对 git 做了一些提交。现在我想重置为已提交的版本之一。我怎样才能在 android studio 中做到这一点?

【问题讨论】:

标签: android git android-studio


【解决方案1】:

我终于找到了解决办法。

  1. 转到 VCS -> Git -> 显示历史记录
  2. Log中,右键单击所需的提交版本并选择Reset Current Branch to Here
  3. 选择Hard并点击Reset按钮。

【讨论】:

    【解决方案2】:

    在 android studio 中打开终端:

    您可以通过以下两个命令来做到这一点:

    git reset --hard [previous Commit SHA id here]
    git push origin [branch Name] -f
    

    它将删除您之前的 git 提交。

    如果您想保留更改,也可以使用:

    git reset --soft [previous Commit SHA id here] 
    

    然后它将保存您的更改。

    更多详情How do you undo the last commit?

    【讨论】:

      猜你喜欢
      • 2016-11-04
      • 2015-06-19
      • 2021-05-30
      • 2019-07-07
      • 2020-01-11
      • 2015-05-08
      • 2016-10-17
      • 2011-04-25
      • 1970-01-01
      相关资源
      最近更新 更多