从已推送的特定提交中撤消工作本地文件夹中的更改

Undo changes in working local folder from specific commit that already pushed

我在 BitBucket 上有一个 git 存储库,2 小时后,我意识到..我犯了错误,需要撤消我的本地工作文件夹和之前的 2 次提交。

我该怎么做?这是我的 git 日志

commit fd04cfd1c3ed6a80649f018cffc80acfee8d022c
Author: R <r@hotmail.com>
Date:   Sat Sep 19 14:43:44 2015 +0800

    theme changed.

commit 11783669c8b8c0dc909dbf15aac085a0c497422c
Author: R <r@hotmail.com>
Date:   Sat Sep 19 14:15:27 2015 +0800

    Modified.. need to change theme..

commit f1c9df7d7f7aec54942e06b70b4908dbfe7b9f17
Author: R <r@hotmail.com>
Date:   Sat Sep 19 08:29:15 2015 +0800

    Create 2 testing file for:
    - check session level
    - check WHOIS session

commit 41828c1d6f984821d5c7b3cb2d0cac269da2b03e
Author: R <r@hotmail.com>
Date:   Sat Sep 19 01:05:41 2015 +0800

    Prevent others user level and anonymous user from entering PTM level

提交哈希 11783669c8b8c0dc909dbf15aac085a0c497422c 是我的目标,用于撤消我本地的所有更改。

使用git revertgit revert --help 将向您解释它的作用和使用方法:

git revert f1c9df7d7f..fd04cfd1c3e

例如。

我假设你想删除包括 11783669c8b8c0dc909dbf15aac085a0c497422c 如果你想在本地删除它不想推送恢复签入然后做:

git 重置 HEAD f1c9df7d7f7aec54942e06b70b4908dbfe7b9f17

git结帐。

并删除新添加的文件

如果你想推送恢复签到,那么做:

git 还原 fd04cfd1c3ed6a80649f018cffc80acfee8d022c

git 还原 11783669c8b8c0dc909dbf15aac085a0c497422c

这将是两个新的还原更改的提交