2015-04-27 107 views
1

我收到一封電子郵件今日說法:什麼是git命令來判斷我的repo目前是否在特定提交之前或之後?

,如果你做了一個混帳拉和混帳包括散列X123和運行測試,這可能損壞你的機器。你需要刷新它並重新開始。如果你在這之前或者在我們使用了補丁之後拉動 - 那麼你很好。

假設:

  • 你有一個陳舊的倉庫(這是在運行之前git commit
  • 我正在尋找的東西不是通過git log結果拖網,如果我能看到更復雜看散列

我的問題是:什麼是git命令告訴我的回購目前是否在特定提交之前或之後?

編輯:

這是詢問哪個分支包含特定提交不同。我試圖看看我的本地陳舊存儲庫是否包含提交。 (或者它絕對不會)。

+0

可能重複[如何列出包含給定提交的分支?](http://stackoverflow.com/questions/1419623/how-to-list-branches-that-c​​ontain-a-given-commit) – harald

+0

這種不同的方式從包含方法?如果你想要一個簡單的是/否,你可以做'git分支 - 包含'。 – musiKk

+0

沒有完整的提交順序,所以整個存儲庫不能在給定提交之前或之後。一個特定的分支頭可能在提交之前或之後,取決於你是否可以達到分支頭的提交。 – chepner

回答

0

我正在尋找的東西不是通過git的拖網 日誌結果,看是否我能看到的哈希

更復雜的怎麼樣grepping爲提交哈希?

[email protected]:~/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 

[email protected]:~/git/project$ git log | grep e2e42a2 
commit e2e42a237248da66bbc16482ab1557d0f404532c 

的grep找到一個結果,因爲後,當前回購的狀態IO 規定提交

[email protected]:~/git/project$ git checkout HEAD^^ 
[email protected]:~/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 

[email protected]:~/git/project$ git log | grep e2e42a2 

的grep覺得沒有什麼,因爲當前回購的狀態是

相關問題