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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Mark24
July 29, 2019
Programming
74
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Git恢复Force Push内容
git高级技巧,恢复force push的内容
Mark24
July 29, 2019
More Decks by Mark24
See All by Mark24
DSL分享
mark24code
0
130
Rails初探
mark24code
0
51
Anti Hook
mark24code
0
80
Other Decks in Programming
See All in Programming
ランチタイムLT会3周年!ランチタイムLT会を3年間続けられたお話
y0hgi
1
140
なぜ型を書くのか? TSKaigi2026で改めて考える #tskaigi_smarthr
kajitack
0
340
エンジニアにデザインハーネスを 〜デザインプロセスを規定するためのハーネス〜 / Design harness from an engineer's perspective
rkaga
2
1.4k
気圧・高度・GPSを記録&可視化するアプリ「Koudo」を作った話
hjmkth
1
350
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
200
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
14
6.8k
Vue × Nuxt × Oxc どこまで使える?実運用の現在地
andpad
0
370
OS アップデート対応の取り組み方がもっと共有されてほしい
andpad
0
110
AIキャラアプリkaiwaの低遅延音声通話基盤をどう作ったか - AWS Gravitonで支える低遅延・低コストAI Agent基盤
mogamit
0
170
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
220
Contextとはなにか
chiroruxx
1
390
ローカルLLMでどこまでコードが書けるか -縮小版 / How much code can be written on a local LLM Shortened
kishida
2
190
Featured
See All Featured
Fireside Chat
paigeccino
42
4k
The Cost Of JavaScript in 2023
addyosmani
55
10k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
190
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.9k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
340
Navigating Team Friction
lara
192
16k
How GitHub (no longer) Works
holman
316
150k
Statistics for Hackers
jakevdp
799
230k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
420
Building AI with AI
inesmontani
PRO
1
1.1k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
190
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4.1k
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