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
370
RailsエンジニアのためのNext.js入門
hokaccha
7
19k
Cookpad Summer Internship 2021 Web Frontend
hokaccha
0
7.1k
巨大なモノリシック Rails アプリケーションの マイクロサービス化戦略 / 2019 microservices in cookpad
hokaccha
3
3.8k
巨大なRailsアプリケーションを「普通」にするための取り組み
hokaccha
1
930
Web Frontend Improvement in Cookpad
hokaccha
1
1k
Other Decks in Technology
See All in Technology
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
6
57k
これからSREになる人と、これからもSREをやっていく人へ
masayoshi
6
4.1k
SA Night #2 FinatextのSA思想/SA Night #2 Finatext session
satoshiimai
1
100
スクラムのイテレーションを導入してチームの雰囲気がより良くなった話
eccyun
0
110
株式会社EventHub・エンジニア採用資料
eventhub
0
4.2k
Ask! NIKKEI RAG検索技術の深層
hotchpotch
13
2.8k
PL900試験から学ぶ Power Platform 基礎知識講座
kumikeyy
0
110
Fintech SREの挑戦 PCI DSS対応をスマートにこなすインフラ戦略/Fintech SRE’s Challenge: Smart Infrastructure Strategies for PCI DSS Compliance
maaaato
0
450
Tech Blogを書きやすい環境づくり
lycorptech_jp
PRO
0
120
アジャイル開発とスクラム
araihara
0
160
Developers Summit 2025 浅野卓也(13-B-7 LegalOn Technologies)
legalontechnologies
PRO
0
150
開発者が自律的に AWS Security Hub findings に 対応する仕組みと AWS re:Invent 2024 登壇体験談 / Developers autonomously report AWS Security Hub findings Corresponding mechanism and AWS re:Invent 2024 presentation experience
kaminashi
0
190
Featured
See All Featured
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.2k
The Cult of Friendly URLs
andyhume
78
6.2k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
29
4.6k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.3k
Designing for Performance
lara
604
68k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.8k
Making Projects Easy
brettharned
116
6k
Automating Front-end Workflow
addyosmani
1367
200k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
114
50k
Building Adaptive Systems
keathley
40
2.4k
Practical Orchestrator
shlominoach
186
10k
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から最新の状態をローカルに反映する