什么是 git 命令来判断我的存储库当前是在特定提交之前还是之后

  • 本文关键字:之后 提交 存储 命令 git 判断 git
  • 更新时间 :
  • 英文 :


我今天收到一封电子邮件说:

如果您执行了 Git 拉取并包含 Git 哈希 X123 并运行了测试,这可能会损坏您的计算机。您需要刷新它并重新开始。但是,如果您在这之前或我们应用补丁之后拉动 - 那么您没事。

假设:

  • 您有一个过时的存储库(这是在运行git commit之前)
  • 我正在寻找比拖网git log结果并查看我是否可以看到哈希值更复杂的东西

我的问题是:什么是 git 命令来判断我的存储库当前是在特定提交之前还是之后?

编辑:

这与询问哪些分支包含特定提交不同。我正在尝试查看我的本地陈旧存储库是否包含提交。(或者它绝对没有)。

我正在寻找比通过 git 拖网更复杂的东西 记录结果并查看我是否可以看到哈希

如何为提交哈希进行 grepping?

tim@tim-N53SN:~/git/project$ git log --graph --decorate --branches --pretty="oneline" --abbrev-commit
* e2e42a2 (HEAD, origin/master, origin/HEAD, master) Create new User in Splash (if first launch) instead of MyIDSActivity
* 7466154 Added SplashActivity that checks if it's the first start
* 1f0ba11 Replace hardcoded IDs in MyIDS with real data
* 26ee0b9 Changed actionbar and chat bubble colors
tim@tim-N53SN:~/git/project$ git log | grep e2e42a2
commit e2e42a237248da66bbc16482ab1557d0f404532c

grep 找到一个结果,因为当前存储库状态 io 在指定的提交之后

tim@tim-N53SN:~/git/project$ git checkout HEAD^^
tim@tim-N53SN:~/git/project$ git log --graph --decorate --branches --pretty="oneline" --abbrev-commit
* e2e42a2 (origin/master, origin/HEAD, master) Create new User in Splash (if first launch) instead of MyIDSActivity
* 7466154 Added SplashActivity that checks if it's the first start
* 1f0ba11 (HEAD) Replace hardcoded IDs in MyIDS with real data
* 26ee0b9 Changed actionbar and chat bubble colors
tim@tim-N53SN:~/git/project$ git log | grep e2e42a2

grep 什么也没找到,因为当前存储库状态在之前

最新更新