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
59
Git恢复Force Push内容
git高级技巧,恢复force push的内容
Mark24
July 29, 2019
Tweet
Share
More Decks by Mark24
See All by Mark24
DSL分享
mark24code
0
110
Rails初探
mark24code
0
43
Anti Hook
mark24code
0
70
Other Decks in Programming
See All in Programming
PipeCDのプラグイン化で目指すところ
warashi
1
280
「Cursor/Devin全社導入の理想と現実」のその後
saitoryc
0
830
初学者でも今すぐできる、Claude Codeの生産性を10倍上げるTips
s4yuba
16
11k
Is Xcode slowly dying out in 2025?
uetyo
1
280
Agentic Coding: The Future of Software Development with Agents
mitsuhiko
0
110
VS Code Update for GitHub Copilot
74th
2
650
Webの外へ飛び出せ NativePHPが切り拓くPHPの未来
takuyakatsusa
2
560
Claude Code + Container Use と Cursor で作る ローカル並列開発環境のススメ / ccc local dev
kaelaela
10
5.5k
Team operations that are not burdened by SRE
kazatohiei
1
310
猫と暮らす Google Nest Cam生活🐈 / WebRTC with Google Nest Cam
yutailang0119
0
140
Result型で“失敗”を型にするPHPコードの書き方
kajitack
5
910
“いい感じ“な定量評価を求めて - Four Keysとアウトカムの間の探求 -
nealle
2
10k
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.4k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.5k
Optimizing for Happiness
mojombo
379
70k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
2.9k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.3k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
How to Ace a Technical Interview
jacobian
278
23k
Facilitating Awesome Meetings
lara
54
6.4k
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