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.6k
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.2k
Kotlin製のGraphQLサーバーをNode.jsでモジュラモノリス化している話
hokaccha
0
3.4k
GraphQLの負債と向き合うためにやっていること
hokaccha
2
1.4k
ユビーのアーキテクチャに対する取り組み
hokaccha
1
380
RailsエンジニアのためのNext.js入門
hokaccha
7
20k
Cookpad Summer Internship 2021 Web Frontend
hokaccha
0
7.1k
巨大なモノリシック Rails アプリケーションの マイクロサービス化戦略 / 2019 microservices in cookpad
hokaccha
3
3.8k
巨大なRailsアプリケーションを「普通」にするための取り組み
hokaccha
1
940
Web Frontend Improvement in Cookpad
hokaccha
1
1k
Other Decks in Technology
See All in Technology
1行のコードから社会課題の解決へ: EMの探究、事業・技術・組織を紡ぐ実践知 / EM Conf 2025
9ma3r
12
4.5k
わたしがEMとして入社した「最初の100日」の過ごし方 / EMConfJp2025
daiksy
14
5.4k
AIエージェント時代のエンジニアになろう #jawsug #jawsdays2025 / 20250301 Agentic AI Engineering
yoshidashingo
8
4k
RayでPHPのデバッグをちょっと快適にする
muno92
PRO
0
190
クラウド食堂とは?
hiyanger
0
120
Two Blades, One Journey: Engineering While Managing
ohbarye
4
2.4k
Snowflakeの開発・運用コストをApache Icebergで効率化しよう!~機能と活用例のご紹介~
sagara
1
520
目標と時間軸 〜ベイビーステップでケイパビリティを高めよう〜
kakehashi
PRO
8
920
Introduction to OpenSearch Project - Search Engineering Tech Talk 2025 Winter
tkykenmt
2
170
Охота на косуль у древних
ashapiro
0
120
サイト信頼性エンジニアリングとAmazon Web Services / SRE and AWS
ymotongpoo
7
1.8k
2/18 Making Security Scale: メルカリが考えるセキュリティ戦略 - Coincheck x LayerX x Mercari
jsonf
0
240
Featured
See All Featured
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
40
2k
Making the Leap to Tech Lead
cromwellryan
133
9.1k
Practical Orchestrator
shlominoach
186
10k
Designing for humans not robots
tammielis
250
25k
Building Applications with DynamoDB
mza
93
6.2k
Six Lessons from altMBA
skipperchong
27
3.6k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.2k
A Tale of Four Properties
chriscoyier
158
23k
Visualization
eitanlees
146
15k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
227
22k
Building a Scalable Design System with Sketch
lauravandoore
461
33k
Faster Mobile Websites
deanohume
306
31k
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 git@ghe.ckpd.co:your-name/repo.git •作業ブランチを切る $ git checkout -b
new-feature •変更をリモートリポジトリに反映する $ git commit -m $ git push origin new-branch
•upstreamのリモートリポジトリを設定 $ git remote add upstream git@ghe.ckpd.co: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から最新の状態をローカルに反映する