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
cookpad summer internship 2018 - Git
Search
Kazuhito Hokamura
September 18, 2018
Technology
1
9.7k
cookpad summer internship 2018 - Git
Kazuhito Hokamura
September 18, 2018
Tweet
Share
More Decks by Kazuhito Hokamura
See All by Kazuhito Hokamura
TypeScriptとGraphQLで実現する 型安全なAPI実装 / TSKaigi 2024
hokaccha
5
4.7k
Kotlin製のGraphQLサーバーをNode.jsでモジュラモノリス化している話
hokaccha
0
3.6k
GraphQLの負債と向き合うためにやっていること
hokaccha
2
1.5k
ユビーのアーキテクチャに対する取り組み
hokaccha
1
440
RailsエンジニアのためのNext.js入門
hokaccha
7
20k
Cookpad Summer Internship 2021 Web Frontend
hokaccha
0
7.2k
巨大なモノリシック Rails アプリケーションの マイクロサービス化戦略 / 2019 microservices in cookpad
hokaccha
3
3.9k
巨大なRailsアプリケーションを「普通」にするための取り組み
hokaccha
1
1k
Web Frontend Improvement in Cookpad
hokaccha
1
1.1k
Other Decks in Technology
See All in Technology
How to achieve interoperable digital identity across Asian countries
fujie
0
120
多様な事業ドメインのクリエイターへ 価値を届けるための営みについて
massyuu
1
340
VCC 2025 Write-up
bata_24
0
180
後進育成のしくじり〜任せるスキルとリーダーシップの両立〜
matsu0228
7
2.6k
成長自己責任時代のあるきかた/How to navigate the era of personal responsibility for growth
kwappa
3
280
Escaping_the_Kraken_-_October_2025.pdf
mdalmijn
0
140
about #74462 go/token#FileSet
tomtwinkle
1
380
Green Tea Garbage Collector の今
zchee
PRO
2
390
Where will it converge?
ibknadedeji
0
190
研究開発部メンバーの働き⽅ / Sansan R&D Profile
sansan33
PRO
3
20k
E2Eテスト設計_自動化のリアル___Playwrightでの実践とMCPの試み__AIによるテスト観点作成_.pdf
findy_eventslides
1
420
生成AIで「お客様の声」を ストーリーに変える 新潮流「Generative ETL」
ishikawa_satoru
1
320
Featured
See All Featured
Building an army of robots
kneath
306
46k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
32
2.2k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.2k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
9
850
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.7k
GitHub's CSS Performance
jonrohan
1032
460k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
It's Worth the Effort
3n
187
28k
Building Adaptive Systems
keathley
43
2.8k
Embracing the Ebb and Flow
colly
88
4.8k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Transcript
Git/GitHub クックパッド サマーインターンシップ 10 Day Tech for service engineers
Git使ったことある人
この講義の内容 • Git/GitHubを使ったチーム開発での流れを理解する • Cookpadでのルールやワークフローを知る
Git
Git • 分散型のバージョン管理システム • Linuxの作者であるLinus Torvaldsによって開発された
Reference •Gitコマンドの使い方を調べる ‣ https://git-scm.com/docs ‣ git help •Gitを体系的に学ぶ ‣ https://git-scm.com/book/en/v2
•ユーザー設定 $ git config --global user.name "Your full name" $
git config --global user.email "your email address" •リポジトリ作成 $ mkdir -p ~/works/git-practice $ cd ~/works/git-practice $ git init •コミット $ echo '# Hello cookpad!' > README.md $ git add README.md $ git commit -m 'Add README.md'
コミットメッセージ •コミットメッセージは英語で書く(社内ルール) •1行目に概要を書く •必要に応じて3行目以降に詳細を書く
Branch
Branchとは •履歴を枝分かれさせることができる •複数の機能を同時に開発することができる •枝分かれした履歴は特定の枝(branch)に合流 (merge)することができる
None
•新しくブランチを作って切替 $ git branch new-branch $ git checkout new-branch •まとめてやる
$ git checkout -b new-branch
merge •Gitは 3-way merge という賢いマージのアルゴリズム でマージする •2つのファイルを単純に比較するのではなくそれぞれの 共通の親と差分を比較する
merge $ git checkout master $ git merge new-branch [--ff/--no-ff]
None
None
None
fast forward merge
--no-ff
ff vs no-ff •Pull Requestのマージは merge commitをつくる •GitHubのUIからマージする 場合はデフォルト no-ff
Recovery
•間違えてaddした $ git reset [<path/to/file>] •間違えてコミットした $ git reset HEAD^
•間違えてファイルを編集したり消してしまったので元に戻したい $ git checkout <path/to/file> $ git checkout .
•ブランチ名間違えた $ git branch -m new-branch-name •バグがあるコードをmasterにマージしてしまったので取り消したい $ git revert
-m 1 <merge-commit> •間違えてコミットを取り消した、マージしてないブランチを 消してしまった $ git reflog $ git reset --hard <SHA1>
GitHub
GitHub •Gitのリモートリポジトリをホスティングするサービス •開発時に便利な様々な機能がある •現代の開発フローにおける中心的存在 •CookpadではGitHub Enterprise(GHE)を利用
ForkとPull Request •Fork ‣ 他の人のリモートリポジトリを自分のリポジトリとして コピーする機能 •Pull Request ‣ 自分が行った変更を元のブランチに取り込んでもらえる
ように通知する機能
GitHub Work Flow 1. 変更対象のリポジトリをForkしてclone 2. branchを切って変更をcommit, push 3. Pull
Request 4. コードレビュー 5. マージ
tech/cookpad_all your-name/cookpad_all Local Fork Pull Request push pull upstream origin
•forkしたリポジトリを手元にコピーする $ git clone
[email protected]
:your-name/repo.git •作業ブランチを切る $ git checkout -b
new-feature •変更をリモートリポジトリに反映する $ git commit -m $ git push origin new-branch
•upstreamのリモートリポジトリを設定 $ git remote add upstream
[email protected]
:owner/repo.git •リモートリポジトリの設定を確認 $ git
remote -v •最新の状態を手元に持ってくる $ git checkout master $ git pull upstream master
Practice
1. summer-intern/self-introduction をfork 2. 作業用ブランチを切る 3. "your-name.md" というファイルを作って簡単な自己紹介を書く 4. 変更をPushしてPull
Requestを作成 5. マージされたらupstreamから最新の状態をローカルに反映する