際際滷

際際滷Share a Scribd company logo
Effective Git
?? ??? ? ????
???
??
???
? 2010-2014.3 <?????>
? 2014.3-2014.11 <Project N>
? 2014.12- <??? ?: ???>
? KGC14 <????? ?????>
? NDC15 <????? ? ????>
? NDC16 <Find My AndPhone>
? NDC16 <Effective Git>
kexplo
http://chanwoong.kim
cwkim@nexon.co.kr
kexplo
?? ??
Git ????? ??
? ??? ???? VCS? ???? ??
? ?? VCS? ???? ???? ??
? svn checkout ★ git clone
? svn update ★ git pull
? svn commit ★ git commit
? ???? ?? ??
? ???? ?? ????? ??
? Git? ?? ?? ???? ??!
? http://d.hatena.ne.jp/gu_he_he/20120322/1332419643
?? Git ?? ????
??? ??
Git ???
???
push, commit ??? ???? ??? ??
???
?? ????
?? ?? ??
?? ?
?? ???? ?? ??? ? ????
? git? command line?? ?? ?? ?
? GUI ?? ?? ??
? Staging area ? ?? ???? ?
?? ?? ???
? ?? Git ???
? ??? Git? ???, Git? ?? ?? ?? ????? ´
? Git ?? ??
? blob, tree object, commit object, ´
? ?? ??? ??? ???´
?? ? ???
? Git ?? ??
? Rebase
? ?? ??? ? ?? 16?? ?? ??
? 3?? ??? ???? ??
? ??? ?? ??
?? ? ???
? Git ?? ??
? Rebase
? ?? ??? ? ?? 16?? ?? ??
? 3?? ??? ???? ??
? ??? ?? ??
1. ??? ???
2. ?? ????
3. ?? ????
Git ?? ??
git flow
Forward-porting
Branching, Merge? ?? ?? ???
?? == ?? ?? ??
[NDC16] Effective Git
Git-flow
gitflow
Forwa
Git-flow ??? ??
? Vincent Driessen? ??
? ??? ?? ???? ???? ??
? master branch: ?? ??
? develop branch: ?? ??
? ??? ?? ??? ? ??? ?? ??
? Git-flow? ???? ??, ??? ??/??? ?? ? ?
? ?? ??
develop
? ?? ??
develop
feature/awesome
$ git flow feature start awesome
$ git commit -a
$ git commit -a
$ git commit -a
? ?? ??
develop
feature/awesome
$ git flow finish awesome
? ??
develop
? ??
develop
release/v1.0.0
$ git flow release start v1.0.0
$ git commit -a
$ git commit -a
$ git commit -a
? ??
develop
$ git flow release finish v1.0.0
master
tag v1.0.0
? ??
master
tag v1.0.0
? ??
master
hotfix/fix1
$ git flow hotfix start fix1
$ git commit -a
$ git commit -a
$ git commit -a
? ??
master
$ git flow hotfix finish fix1
develop
tag fix1
hotfix/fix1
? ??
develop
feature/awesome
release/v1.0.0
master
feature
release
hotfix
tag v1.0.0
hotfix/fix1
tag fix1
? ??
develop
feature/awesome
release/v1.0.0
master
feature
release
hotfix
tag v1.0.0
hotfix/fix1
tag fix1
? ??
develop
feature/awesome
release/v1.0.0
master
feature
release
hotfix
tag v1.0.0
hotfix/fix1
tag fix1
? ??
develop
feature/awesome
release/v1.0.0
master
feature
release
hotfix
tag v1.0.0
hotfix/fix1
tag fix1
??
? ??? ??
? feature ★ develop ?? ?? == ??? ??? ???
? ?? ??? feature branch? ???? ?? ??? ??? ??
? ?? ??
? ???? ??? ??? ?? ??? Hook?? ?? ??
? hotfix ??? ?? ??
Forward-porting
Forward-p
gitf
feature/blahblah
master
Forward-porting
feature/blahblah
$ git pull --rebase origin/master
origin/master
Forward-porting
master
feature/b
origin/master
Forward-porting $ git pull --rebase origin/master
master
??
? ?? ???? ??? ??
? ?? ??? ?? ??? ?? ? ???? ?? ???? ??? ?..
? ?? ??? ?? ???? ??, ?? ??
? ?? ?? ??
? ? ??? ??? ??? ?
? ?? ? ?? ??? ??? ?? ? ??? ???
? ?? ??? ?? ??? ???? ???? OK
? ???????
? Git-flow
? release ???? Hook? ??
? ??? ???? ?? ??, ???, ??
? Forward-porting
? ?? ???? ??? ??? ? ?? ?? ??
? ?? ?? ?, ??? ??? ???(?)? ?? ??
Rebase
rebase ?? ??
?? ????
rebase ?? ??
rebase?
???
Rebase
? Base? ???(Re-)?? ??
? Forward-porting? Rebase? ??? ??
? Rebase? ?? base? ?? ?? ?? ???? ??
B C D
feature/abc
E FA
develop
HEAD
B C D
feature/abc
E FA
develop
$ git checkout feature/abc
$ git rebase develop
HEAD
B C D
feature/abc
E FA
develop
?? ??? ??
HEAD
B C D
feature/abc
E FA
develop
????? ? ???? ??? ??? ?
HEAD
B C D
B` C` D`
feature/abc
E FA
develop
?? ???? ??
HEAD
B C D
B C D
?? ????
?????
reba
??? ??? ?? ???
$ git rebase Ci [<?? ??>]
??? ??? ?? ???
$ git rebase Ci [<?? ??>]
Rebase? ?? ??? ?? ???? ??? ??,
??? ???? ??? ? ??.
16?? ?? ??
1. ??? ???
2. ?? ????
3. ?? ????
1. ??? ???
stash
bisect
blame
worktree
Hunk ?? ????
?? ??? ?? ????
alias
shallow clone
2. ?? ????
3. ?? ????
$ git stash save
Pop
Apply
List
drop
stash
bise
bla
workt
Hunk
???
ali
shall
?? ? ????
? ?? ???? ?
? ?? A? ?? ???, ?? B? ?? ? ?????
? ABC
stash? ?? ?? ????? ?? ?? ??
stash stack? ?? ???.
WIP
WIP
stash
Working Directory
git stash save
git stash pop
???
? ?? ?? ?? ?? ?? ??
? ??? ??? ?? ?
? ?? ?? ?? ???
git stash
? ?? ?? ?? ?? ?? ??
? $ git stash save
? ??? ??? ?? ?
? ?? ?? ?? ???
? $ git stash pop
?? ??? ??
? $ git stash list
? $ git stash apply [<stash>]
? $ git stash drop [<stash>]
$ git bisect start
good
bad
log
reset
bisect
sta
bla
workt
Hunk
???
ali
shall
??
? ?? ?? ??? ????.
? ????
? ?? ????
? ?? ??? ?? ??? ?? ? ????
??? ??? ??
? http://ff663.blogspot.kr/2010/05/201058-
in-english-i-feel-complete.html
[NDC16] Effective Git
bisect? ??? ?? ??? ???
??? ?? ?? ?? ??.
HEAD
$ git bisect start
HEAD
$ git bisect start
$ git bisect bad
HEAD
$ git bisect start
$ git bisect bad
$ git bisect good f794027
f794027
HEAD
f794027
HEAD
$ git bisect good
f794027
HEAD
f794027
HEAD
f794027
HEAD
$ git bisect bad
f794027
HEAD
f794027
HEAD
$ git bisect bad
f794027
HEAD
$ git bisect bad
? ?
? $ git bisect log
? $ git bisect reset
?.. ??? ?????
? ?? ???!
? ??? ?? ??! (???? ??? ??)
? $ git bisect start
? # test_error.sh? ??? ?? ?? 1? ??.
? $ git bisect run test_error.sh
$ git blame
-L <start,end>
-C
blame
sta
bise
workt
Hunk
???
ali
shall
blame
? bisect? ?? ??? ????
? ?? ???? ?? ??(?)? ? ??
? ?????
$ git blame -L 10,11 effective_git.md
$ git blame -L 10,11 effective_git.md
??? ?? ?? ??
? ?? ??
??
$ git blame -L 10,11 effective_git.md
??? ?? ?? ??
? ?? ??
??
-C
??? ?? ??
$ git worktree add
prune
list
worktree
sta
bla
bise
Hunk
???
ali
shall
?? ? ???? (???)
? ?? ???? ?
? ?? A? ?? ???, ?? B? ?? ? ?????
? ABC
?? ? ???? (???)
? ?? ???? ?
? ?? A? ?? ???, ?? B? ?? ? ?????
? ?? ??? ? ?
? ABC
?? ??? ??
? ?? ????? ??? ??? ?? ??
? ???? ??? ????, ???? ??? ????´
? stash? ? ???, untracked ??? ? ??´
? ?? ?? ??? ???? ?? ??
?? ??? ??
? ?? ????? ??? ??? ?? ??
? ???? ??? ????, ???? ??? ????´
? stash? ? ???, untracked ??? ? ??´
? ?? ?? ??? ???? ?? ??
worktree? ?? ?? ?? ??? ??? ? ?? ? ?
$ git worktree add Cb emergency-fix ../temp master
$ git worktree add Cb emergency-fix ../temp master
?? ?? ???
? worktree ??
? worktree? chekcout? ???
$ git worktree add Cb emergency-fix ../temp master
$ pushd ../temp
# ... ? ?? ...
$ popd
??? ????
? ??? ???
?? ????
$ git worktree add Cb emergency-fix ../temp master
$ pushd ../temp
# ... ? ?? ...
$ popd
$ rm Crf ../temp
$ git worktree prune
Worktree? ??
Hunk ??? ?? (`-p¨ ?? ??)
$ git add C沿
$ git checkout C沿
$ git stash -p
Hunk???
sta
bla
workt
???
ali
bise
shall
Atomic commit
? ^(?? ? ??)???? ??Atomic ̄? ?? ??
? ?? VCS??? ???? ??
? ??
? ?? ?? ?? ??
? ?? ?? ??
??? ??
? ?? ?? ? ??? ???
? ?? ?? ? ? ??.
? ???? ?? ?? ???? ?? ?? ????´
??? ??
? ?? ?? ? ??? ???
? ?? ?? ? ? ??.
? ???? ?? ?? ???? ?? ?? ????´
? ?? ? ??? ^-p ̄ ??.
?$ git add
?$ git add C沿
?$ git add C沿
?$ git add C沿
?$ git reset C沿
?$ git checkout C沿
?$ git rm -p
[NDC16] Effective Git
?? ??? ?? ????
$ git checkout
$ git show
?????
sta
bla
workt
Hunk
ali
bise
shall
checkout
? ???? ??? ???
? ?? ??? ??? ???? ? ?? ???
$ git checkout master -- Readme.md
Readme.md? master ???? ??? checkout
show
? 1? ??? ????(blob, tree, commit, ´)? ?? ???
? $ git show fc1b357:Readme.md > master_Readme.md
fc1b367 ??? Readme.md? master_Readme.md? ??
alias
alias
sta
bla
workt
Hunk
???
bise
shall
?? ??? ?????
? ??? ?? ??
? git status ★ git st
? ?? ???? ?? ??? ??
? ? alias? ????.
[NDC16] Effective Git
[NDC16] Effective Git
git lg
? ?? ???? ??? ???? alias
[alias]
lg = log --graph --abbrev-commit --decorate --date=relative
--format=format:'%C(bold red)%h%C(reset) - %C(bold
green)(%ar)%C(reset) %C(white)%s%C(reset) %C(cyan)<%an>%C(res
et)%C(bold yellow)%d%C(reset)' --all
[NDC16] Effective Git
shallow clone
$ git clone Cdepth
$ git fetch --depth
$ git fetch --unshallow
sallowcl
sta
bla
workt
Hunk
???
ali
bise
??? N? ??? ??? ?
? ?? ???, ??, ?? ?? ´
? ?? ???? ?? ? ?
$ git clone
$ git clone --depth 1
depth ??
$ git fetch --depth <N>
Q. Push? ? ??
Q. Push? ? ??
$ git fetch --unshallow
2. ?? ????
3. ?? ????
git log
??? ????
git log -S
??? ?? ??
git grep
git rev-list
1. ??? ???
git log
gitlog
???
gitl
???
gitg
gitr
?? ??
$ git log <sha1 hash>
git log ?? ??
? `/¨ ? ??? ??
? n, N (search Next) ??
?? ?? ??
? Vi ?? j, k? ?, ?? ??
[NDC16] Effective Git
??? ????
^, ~, .., ...
?????
gitl
???
gitg
gitr
git
?? ???? ??? ?? ?? ??
? ?? ???
? d206ec8 ?? 727372a? ?? ???
?? ???? ??? ?? ?? ??
? ?? ???
? d206ec8 ?? 727372a? ?? ???
? ??? ?
? ?.. ???? ?? ?? ? ?? ??? ?? ????
?? ???? ??? ?? ?? ??
? ?? ???
? d206ec8 ?? 727372a? ?? ???
? ??? ?
? ?.. ???? ?? ?? ? ?? ??? ?? ????
^ (Circumflex)
?^n
? n?? ?? ??? ???
? n? 1? ?? ?? ?? ( ^1 == ^ )
HEAD
HEAD
HEAD^
HEAD^1
HEAD^2
HEAD
HEAD^^
HEAD
HEAD^^
(HEAD^)^
~ (Tilde)
? ~n? n? ? ?? ??
HEAD
HEAD
HEAD~
HEAD~1
HEAD
HEAD~
HEAD~1HEAD~2
HEAD
HEAD~
HEAD~1HEAD~2
HEAD~3
.. (double dot)
? ??? ?? ?
? start..end : end? ??, start? ? ?? ?? ??
[NDC16] Effective Git
HEAD~3..HEAD
? ???
B C D
JIHGFE
A
develop..master? ??? ???? (3?)
develop
master
B C D
JIHGFE
A
develop..master? ??? ???? (3?)
develop
master
.. (double dot)
? ??? ??? ?? ?
? start..end : end? ??, start? ? ?? ?? ??
.. (double dot)
? ??? ??? ?? ?
? start..end : end? ??, start? ? ?? ?? ??
end?? ??? ? ??, start?? ??? ? ?? ??
end C start ? ???
B C D
JIHGFE
A
develop
master
develop..master
master?? ??? ? ??, develop?? ??? ? ?? ??
master C develop ? ???
... (Triple dot)
? ???? ??? ?? ???? ?? ?? ??? ??
? ?????
A-B B-A
$ git log A...B
B C D
JIHGFE
A
develop
master
develop...master
B C D
JIHGFE
A
develop
master
develop...master
git log CS<string>
gitlog-
???
gitg
gitr
git
???
git log CS<string> # pickaxe
? ??? Diff ?????? ???? ??
? ??? ?? ??? ??? ??
? -M ??? ????, rename??? ??? ? ??.
??? ?? ??
git log --follow
????
gitg
gitr
git
???
gitl
??? ? ??
? ???? ?? ? ??? ??? ???´
? ??? ? ???
???? ??
$ git log Cfollow -- filepath
$ git grep
gitgrep
gitr
git
???
gitl
???
$ git grep
? ??? ?? ?? ? grep? ??
? blob object ????? ???? ??.
? ??? ??? ? ? ??
? $ git grep blahblah
? -- ?? ??? ??? ??? ? ??
? $ git grep blahblah -- Document
$ git grep hello
# -- ?? ??? ??? ??? ? ??
$ git grep hello -- subdirectory
$ git rev-list
gitrev-l
git
???
gitl
???
gitg
rev-list
? commit object? ?? ???? ?? ??
? ?? ??? ?? ??? ? ??
? ?? ???? ??? ? ? ??
? ??? ??? ???? ??
$ git rev-list master -- Readme.md
rev-list
$ git rev-list master -- Readme.md
727372ac234645eeb891272b3fc73c940ea5f52f
c38dc4e678d40dd48072489fda6b8f933cdea0c2
1064cea4cfbf8bd94dff3cc3175d5de2ff5c110c
19424a1bff2223c25905c2e732a857911a0d7c54
189952e05d7cc97a7e408480d00c39c8ab754489
rev-list
$ git rev-list Cn 1 master -- Readme.md
727372ac234645eeb891272b3fc73c940ea5f52f
3. ?? ????
1. ??? ???
2. ?? ????
git reflog
git fsck
Reflog
gitreflo
gitf
History log? ??? ?
? ??? ?? ????
? ??? ??? ?? ???
? ( $ git commit Camend )
? ? ??? ?????, ???? ?? ???? ?? ?
? ???
Commit object? ??
? $ git commit --amend
? ?? ? ??? ??? ?. (sha1 hash ?? ???)
B C DA
B C DA
$ git commit --amend
D`
$ git commit --amend
B C DA
D`
?? ??? dangling commit? ??? ??? ?? ?
GC? ?? ??? ?? ??
?? Push? ? ??? ??? ??
? Reflog? ??? ????? ??? ?
?? Push? ? ??? ??? ??
? Reflog? ??? ????? ??? ?
?? push Cf ? ???? ?? ?????.
1. ??? ?? ???(?) ??? ???
2. hash ? HEAD@{1} ?? ref? HEAD? ??? ??
$ git reset HEAD@{2}
??
? ???
fsck
gitfsck
gitr
dangling commit
? ??? ref? ??? ??? ? ?? ??
B C DA
D`
HEAD
dangling commit ??
$ git fsck
?? ??
Gitlab
Sourcetree
Git kraken
[NDC16] Effective Git
[NDC16] Effective Git
[NDC16] Effective Git
??
? https://git-scm.com/doc
? http://danielkummer.github.io/git-flow-cheatsheet/index.html
? https://www.sourcetreeapp.com/
? https://www.gitkraken.com/
? https://about.gitlab.com/
?????.
cwkim@nexon.co.kr

More Related Content

What's hot (20)

PDF
テ?サ?イナのための赫庄岳秘壇
dsuke Takaoka
?
PDF
Git and git flow
Fran Garc┴a
?
PPTX
Git in 10 minutes
Safique Ahmed Faruque
?
PDF
Github - Git Training 際際滷s: Foundations
Lee Hanxue
?
PDF
Git flow
DaeMyung Kang
?
PDF
‐Unite 2017 Tokyo/仝\T平と易の徴藍々にみるC#でy匯したサ`バ`/クライアント_kとFg議なUniRx聞いこなしg
Unity Technologies Japan K.K.
?
PPTX
CI/CD with GitHub Actions
Swaminathan Vetri
?
PPTX
CICD Pipeline Using Github Actions
Kumar Sh━vam
?
PPTX
??? ????? Jenkins ?????
?? ?
?
PDF
はじめての赫庄岳 韓看姻デザイナ`Ε芥`ダ`
Saeko Yamamoto
?
PDF
Les bases de git
Pierre Sudron
?
PDF
Advanced Git
Sergiu-Ioan Ungur
?
PDF
Git and github 101
Senthilkumar Gopal
?
PDF
LetSwift 2017 - ?? iOS ?? ??/?? ??
Mintak Son
?
PDF
svn ???? ?? git ?? ???
Insub Lee
?
PDF
???, unity build? ???? ?????, NDC2010
devCAT Studio, NEXON
?
PDF
Git - An Introduction
Behzad Altaf
?
PDF
??????? 1???, ????????? ???????
Brian Hong
?
PDF
GitHub Actions in action
Oleksii Holub
?
PDF
Git Tutorial
MDLicht
?
テ?サ?イナのための赫庄岳秘壇
dsuke Takaoka
?
Git and git flow
Fran Garc┴a
?
Git in 10 minutes
Safique Ahmed Faruque
?
Github - Git Training 際際滷s: Foundations
Lee Hanxue
?
Git flow
DaeMyung Kang
?
‐Unite 2017 Tokyo/仝\T平と易の徴藍々にみるC#でy匯したサ`バ`/クライアント_kとFg議なUniRx聞いこなしg
Unity Technologies Japan K.K.
?
CI/CD with GitHub Actions
Swaminathan Vetri
?
CICD Pipeline Using Github Actions
Kumar Sh━vam
?
??? ????? Jenkins ?????
?? ?
?
はじめての赫庄岳 韓看姻デザイナ`Ε芥`ダ`
Saeko Yamamoto
?
Les bases de git
Pierre Sudron
?
Advanced Git
Sergiu-Ioan Ungur
?
Git and github 101
Senthilkumar Gopal
?
LetSwift 2017 - ?? iOS ?? ??/?? ??
Mintak Son
?
svn ???? ?? git ?? ???
Insub Lee
?
???, unity build? ???? ?????, NDC2010
devCAT Studio, NEXON
?
Git - An Introduction
Behzad Altaf
?
??????? 1???, ????????? ???????
Brian Hong
?
GitHub Actions in action
Oleksii Holub
?
Git Tutorial
MDLicht
?

Similar to [NDC16] Effective Git (20)

PPTX
Git
Yong Min Lee
?
PPTX
Git
Junyoung Lee
?
PPT
Git from google techtalks by Randal
yagurchoi
?
PDF
Git: A Motivating Introduction
Jongwook Choi
?
PDF
git-basic-commands
insanehong Kim
?
PDF
About git
?? ?
?
PDF
?????? ?????? ?? ???
Jongdeok Kim
?
PDF
Git? ?? ? ????!
Young Kim
?
PDF
????(SourceTree)? ??? Git ???
?? ?
?
PDF
Git ????? ??? ??? ??????
Dabi Ahn
?
PPTX
Git ??
HyunWook Kang
?
PDF
Git branch stregagy & case study
Woo Jin Kim
?
PDF
11. git basic
Geunhyung Kim
?
PPTX
Advanced git
chanwoo Jeong
?
PPTX
Git lecture2
ssuseraf62e91
?
PPTX
????GIS ?? ?? ????
BJ Jang
?
PPTX
Git ??
?? ?
?
PDF
Git tutorials
wonmin lee
?
PDF
????????????????? ??????? ????
Jong-il Seok
?
PPTX
Git command
Hyeongmin Lee
?
Git from google techtalks by Randal
yagurchoi
?
Git: A Motivating Introduction
Jongwook Choi
?
git-basic-commands
insanehong Kim
?
About git
?? ?
?
?????? ?????? ?? ???
Jongdeok Kim
?
Git? ?? ? ????!
Young Kim
?
????(SourceTree)? ??? Git ???
?? ?
?
Git ????? ??? ??? ??????
Dabi Ahn
?
Git branch stregagy & case study
Woo Jin Kim
?
11. git basic
Geunhyung Kim
?
Advanced git
chanwoo Jeong
?
Git lecture2
ssuseraf62e91
?
????GIS ?? ?? ????
BJ Jang
?
Git ??
?? ?
?
Git tutorials
wonmin lee
?
????????????????? ??????? ????
Jong-il Seok
?
Git command
Hyeongmin Lee
?
Ad

[NDC16] Effective Git