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
66
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
74
Other Decks in Programming
See All in Programming
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
140
Graviton と Nitro と私
maroon1st
0
170
AI前提で考えるiOSアプリのモダナイズ設計
yuukiw00w
0
220
フロントエンド開発の勘所 -複数事業を経験して見えた判断軸の違い-
heimusu
7
2.7k
Deno Tunnel を使ってみた話
kamekyame
0
350
Oxlintはいいぞ
yug1224
5
1.1k
20260127_試行錯誤の結晶を1冊に。著者が解説 先輩データサイエンティストからの指南書 / author's_commentary_ds_instructions_guide
nash_efp
0
340
IFSによる形状設計/デモシーンの魅力 @ 慶應大学SFC
gam0022
1
260
[KNOTS 2026登壇資料]AIで拡張‧交差する プロダクト開発のプロセス および携わるメンバーの役割
hisatake
0
150
Patterns of Patterns
denyspoltorak
0
1.3k
AI Agent Dojo #4: watsonx Orchestrate ADK体験
oniak3ibm
PRO
0
130
副作用をどこに置くか問題:オブジェクト指向で整理する設計判断ツリー
koxya
1
550
Featured
See All Featured
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.3k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.5k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
230
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
95
How to train your dragon (web standard)
notwaldorf
97
6.5k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
220
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
110
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
110
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
190
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
0
250
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
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