2016-09-22 54 views
0

我正在兩個不同的分支AB和我有一個prod分支MASTER,我創建了一個新分支C結合AB如何回滾到較舊的提交,因爲我推送了一個代碼?

我不小心將C推到MASTER,現在我不知道該如何回到prod狀態,因爲提交的提交太多。

commit 92e15c92d543e436bd5804ab6c9 
Author: user_A 
Date: Thu Sep 22 15:51:47 2016 +0530 

    fixing user report 

commit dfd1f4e0d56f50d263d6e 
Merge: 1a6bc83 f9b0a35 
Author: user_A 
Date: Thu Sep 22 15:47:01 2016 +0530 

    Merge branch 'MASTER' of git_repo_branch into B 

commit 1a6bc83c55cf1b3d7f88d 
Author: user_A 
Date: Thu Sep 22 15:46:46 2016 +0530 

    fixing user report 

commit dd11a998f380c70b579d2a0 
Author: user_A 
Date: Thu Sep 22 13:09:29 2016 +0530 

    fixing rake task 

commit c194f900e58f93b0a06ed 
Author: user_A 
Date: Thu Sep 22 13:08:40 2016 +0530 

    fixing rake task 

commit f9b0a35430d29826622d95 
Author: user_B 
Date: Thu Sep 22 11:36:50 2016 +0530 

    jobs save as draft fix 

commit 3a1b233b365a96886e2d73 
Merge: 2eac96c c4f61b1 
Author: user_A 
Date: Thu Sep 22 11:35:20 2016 +0530 

    Merge branch 'A' into B 

commit dfd1f4e0d56f50d263d6eb5 
Merge: 1a6bc83 f9b0a35 
Author: user_A 
Date: Thu Sep 22 15:47:01 2016 +0530 

    Merge branch 'MASTER' of git_repo_branch into B 

commit 1a6bc83c55cf1b3d7f88da697411d5c5acb5b9c4 
Author: user_A 
Date: Thu Sep 22 15:46:46 2016 +0530 

    fixing user report 

commit dd11a998f380c70b579d2a0b 
Author: user_A 
Date: Thu Sep 22 13:09:29 2016 +0530 

    fixing rake task 

commit c194f900e58f93b0a06eddf8 
Author: user_A 
Date: Thu Sep 22 13:08:40 2016 +0530 

    fixing rake task 

commit f9b0a35430d29826622d9 
Author: user_B 
Date: Thu Sep 22 11:36:50 2016 +0530 

    jobs save as draft fix 

commit 3a1b233b365a96886e2d7334 
Merge: 2eac96c c4f61b1 
Author: user_A 
Date: Thu Sep 22 11:35:20 2016 +0530 

    Merge branch 'A' into B 

commit c4f61b151c28ce36b0c7987276df90ddc91c84fc 
Merge: 0f18c62 fb70961 
Author: user_A 
Date: Thu Sep 22 11:35:04 2016 +0530 

commit f9b0a35430d29826622d950b9e149c05cf937644 
Author: user_B 
Date: Thu Sep 22 11:36:50 2016 +0530 

    jobs save as draft fix 

commit 3a1b233b365a96886e2d73 
Merge: 2eac96c c4f61b1 
Author: user_A 
Date: Thu Sep 22 11:35:20 2016 +0530 

Author: user_A 
Date: Thu Sep 22 13:08:40 2016 +0530 

    fixing rake task 

commit f9b0a35430d29826622d950b9 
Author: user_B 
Date: Thu Sep 22 11:36:50 2016 +0530 

    jobs save as draft fix 

commit 3a1b233b365a96886e2d733403fa66e8dd4992fc 
Merge: 2eac96c c4f61b1 
Author: user_A 
Date: Thu Sep 22 11:35:20 2016 +0530 

    Merge branch 'A' into B 

commit c4f61b151c28ce36b0c79872 
Merge: 0f18c62 fb70961 
Author: user_A 
Date: Thu Sep 22 11:35:04 2016 +0530 

    Merge branch 'MASTER' of git_repo_branch into A 

commit 0f18c62cbae31b5f6a76d 
Author: user_A 
Date: Thu Sep 22 11:34:06 2016 +0530 

    changing name to slug 

commit 56fbcd2e544d97aef2bb 
Author: user_A 
Date: Thu Sep 22 11:28:38 2016 +0530 

    changing name to slug 

commit 2eac96cc7c56aa1f3bda29b9257e045c3b923dfe 
Merge: 0caa9d1 f794d6e 
Author: user_A 
Date: Wed Sep 21 17:08:37 2016 +0530 

    added A_to_B 

commit 0caa9d1076ee83d53b0586f2e7cd79f16320ac0e 
Merge: 5df1d6d fb70961 
Author: user_A 
Date: Wed Sep 21 15:49:40 2016 +0530 

    removing conflict 

commit f794d6ee277f0ba5964dc534c05cfe234761e569 
Author: user_A 
Date: Wed Sep 21 15:41:21 2016 +0530 

    fixing users name 

commit cc97e8749cccdfee47bb67bbe6470639afbd1d28 
Author: user_A 
Date: Wed Sep 21 15:15:53 2016 +0530 

    raising 404 if user not found 

commit fb709619d0a9f39c6b2a2c7b5a08c47835970c0f 
Author: user_B 
Date: Wed Sep 21 12:44:32 2016 +0530 

    usercount yopwise report 

commit a332dfe71fd7de74eadcce43337699bb4205e29d 
Author: user_A 
Date: Tue Sep 20 17:29:35 2016 +0530 

    code error fix 

commit 323fa5ed6b2002a664adcfc1ae6b295198258fe2 
Author: user_A 
Date: Tue Sep 20 17:22:50 2016 +0530 

    limiting 

commit ea94a85e1ad259162d4a883cda08635697012602 
Author: user_A 
Date: Tue Sep 20 17:15:17 2016 +0530 
+0

確保其他協作者不訪問您的錯誤推送,並按照此鏈接回退到最後已知的穩定提交 - http://stackoverflow.com/a/6655126/6527796 – Mithun

+0

我應該做遠程回購直接或從我的本地? – sahil

+0

對您的prod分支進行更改。你想恢復推到MASTER的權利?找出prod和fallback的最後一個穩定提交,強制推動它覆蓋master的更改。 – Mithun

回答

1

您可以回滾到一個較早的提交,檢查git log瞭解更多詳情, 然後迫使你提交到主分支:

git push origin +<shaofcommit>:master 

+將強制提交,或者你也可以使用-f選項。

+0

當我拉進我的MASTER分支時,我總是收到最新的東西。 – sahil

+0

這意味着它的結果是你期望與否? – tokhi

相關問題