Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Git恢复Force Push内容
Search
Mark24
July 29, 2019
Programming
0
62
Git恢复Force Push内容
git高级技巧,恢复force push的内容
Mark24
July 29, 2019
Tweet
Share
More Decks by Mark24
See All by Mark24
DSL分享
mark24code
0
120
Rails初探
mark24code
0
43
Anti Hook
mark24code
0
72
Other Decks in Programming
See All in Programming
CSC509 Lecture 02
javiergs
PRO
0
410
詳しくない分野でのVibe Codingで困ったことと学び/vibe-coding-in-unfamiliar-area
shibayu36
3
4.7k
2分台で1500examples完走!爆速CIを支える環境構築術 - Kaigi on Rails 2025
falcon8823
3
3.4k
なぜGoのジェネリクスはこの形なのか? Featherweight Goが明かす設計の核心
ryotaros
7
1k
(Extension DC 2025) Actor境界を越える技術
teamhimeh
1
240
止められない医療アプリ、そっと Swift 6 へ
medley
1
130
Pythonスレッドとは結局何なのか? CPython実装から見るNoGIL時代の変化
curekoshimizu
5
1.6k
GitHub Actions × AWS OIDC連携の仕組みと経緯を理解する
ota1022
0
250
CSC305 Lecture 06
javiergs
PRO
0
210
Playwrightはどのようにクロスブラウザをサポートしているのか
yotahada3
7
2.3k
CSC509 Lecture 01
javiergs
PRO
1
440
Things You Thought You Didn’t Need To Care About That Have a Big Impact On Your Job
hollycummins
0
200
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
697
190k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
KATA
mclloyd
32
15k
Embracing the Ebb and Flow
colly
88
4.8k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.2k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Six Lessons from altMBA
skipperchong
28
4k
Writing Fast Ruby
sferik
629
62k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
970
How to train your dragon (web standard)
notwaldorf
96
6.3k
Reflections from 52 weeks, 52 projects
jeffersonlam
352
21k
Balancing Empowerment & Direction
lara
4
680
Transcript
Git 远程恢复被force-push的队友的commit 2019.07.29 @mark
情景⼀一
情景⼀一:彼此没有沟通,A、B各⾃自依次force push的了了代码。 远程仓库显示了了最后的B的提交。 请问如何,恢复A的部分commit? 开发A 开发B 远程仓库 19:00 pm force
push 19:50 pm force push
⽅方法⼀一 ⽤用户A解决
经过沟通,开发者A可以cherry-pick或者rebase,把⾃自⼰己的本地 提交,和远程分⽀支,进⾏行行处理理,再进⾏行行后续的追加提交。
⽅方法⼆二 中央仓库解决
远程机器器,git reflog ,使⽤用cherry-pick恢复。 实际上这个不不合理理。中⼼心节点,不不应该操作。 其实我不不太清楚,中央节点,有没有reflog,应该是有的 中央仓库解决
⽅方法三 ⽤用户B解决
1.本地reflog仅仅是⾃自⼰己的——⽆无法下载到远程的reflog。这条 路路不不通。 2.⽆无法QQ远程共享屏幕帮A操作,假设A还离职了了,还删除了了 远程仓库(Hard模式) B在本地⽆无记录的情况下如何恢复A的部分节点? B的Hard模式
Git-apply Git-am
1.中央仓库是有记录的。 2.查看想要找回的commit 3.下载patches⽂文件 4.本地使⽤用 git apply 针对单个⽂文件 5.本地使⽤用 git am
针对单⽂文件、⽬目录(批量量⽂文件) 6.区别am会⽣生成commit节点。这个就是我们想要的
问题解决 The End