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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Mark24
July 29, 2019
Programming
72
0
Share
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
47
Anti Hook
mark24code
0
79
Other Decks in Programming
See All in Programming
LLM Plugin for Node-REDの利用方法と開発について
404background
0
150
初めてのRubyKaigiはこう見えた
jellyfish700
0
370
作って学ぶ、 JSX (TSX) ランタイムの基本
syumai
7
1.2k
誰も頼んでない機能を出荷した話
zekutax
0
150
tsserverとは何だったのか、これからどうなるのか
nowaki28
1
430
Why Laravel apps break—Mastering the fundamentals to keep them maintainable
kentaroutakeda
1
320
AIチームを指揮するOSS「TAKT」活用術 / How to Use “TAKT,” an OSS Tool for Orchestrating AI Teams
nrslib
6
760
Oxcを導入して開発体験が向上した話
yug1224
4
260
Moments When Things Go Wrong
aurimas
3
130
権限チェックの一貫性を型で守る TypeScript による多層防御
mnch
4
990
Modding RubyKaigi for Myself
yui_knk
0
830
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
140
Featured
See All Featured
Making Projects Easy
brettharned
120
6.7k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
The agentic SEO stack - context over prompts
schlessera
0
790
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
How GitHub (no longer) Works
holman
316
150k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
240
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.5k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.4k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
950
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
320
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