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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Kazuhito Hokamura
September 18, 2018
Technology
1
9.8k
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.9k
Kotlin製のGraphQLサーバーをNode.jsでモジュラモノリス化している話
hokaccha
0
3.7k
GraphQLの負債と向き合うためにやっていること
hokaccha
2
1.6k
ユビーのアーキテクチャに対する取り組み
hokaccha
1
470
RailsエンジニアのためのNext.js入門
hokaccha
7
21k
Cookpad Summer Internship 2021 Web Frontend
hokaccha
0
7.3k
巨大なモノリシック Rails アプリケーションの マイクロサービス化戦略 / 2019 microservices in cookpad
hokaccha
3
4k
巨大なRailsアプリケーションを「普通」にするための取り組み
hokaccha
1
1.1k
Web Frontend Improvement in Cookpad
hokaccha
1
1.1k
Other Decks in Technology
See All in Technology
Digitization部 紹介資料
sansan33
PRO
1
7k
研究開発部メンバーの働き⽅ / Sansan R&D Profile
sansan33
PRO
4
22k
Devinを導入したら予想外の人たちに好評だった
tomuro
0
740
Databricksアシスタントが自分で考えて動く時代に! エージェントモード体験もくもく会
taka_aki
0
270
Windows ネットワークを再確認する
murachiakira
PRO
0
220
作るべきものと向き合う - ecspresso 8年間の開発史から学ぶ技術選定 / 技術選定con findy 2026
fujiwara3
6
1.7k
バクラクのSREにおけるAgentic AIへの挑戦/Our Journey with Agentic AI
taddy_919
2
910
Secure Boot 2026 - Aggiornamento dei certificati UEFI e piano di adozione in azienda
memiug
0
130
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.4k
クラウド時代における一時権限取得
krrrr38
1
150
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
15
95k
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
3k
Featured
See All Featured
Ruling the World: When Life Gets Gamed
codingconduct
0
160
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
Navigating Weather and Climate Data
rabernat
0
130
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
140
Prompt Engineering for Job Search
mfonobong
0
180
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
450
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
93
How to make the Groovebox
asonas
2
2k
The Limits of Empathy - UXLibs8
cassininazir
1
240
Amusing Abliteration
ianozsvald
0
120
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から最新の状態をローカルに反映する