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
73
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
50
Anti Hook
mark24code
0
80
Other Decks in Programming
See All in Programming
A2UI という光を覗いてみる
satohjohn
1
140
Strategic Design in the Frontend: Moduliths & Micro Frontends @DDDEurope
manfredsteyer
PRO
0
110
net-httpのHTTP/2対応について
naruse
0
500
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
14
5.6k
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.3k
Vite+ Unified Toolchain for the Web
naokihaba
0
320
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
6.8k
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
1
260
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
200
[2026年度第1回ORセミナー] 計画最適化ベンチャーと競技プログラミング人材
terryu16
0
270
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
550
Inside Stream API
skrb
1
740
Featured
See All Featured
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
850
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.3k
Prompt Engineering for Job Search
mfonobong
0
350
Un-Boring Meetings
codingconduct
0
320
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
850
Code Reviewing Like a Champion
maltzj
528
40k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.7k
Being A Developer After 40
akosma
91
590k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
180
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