Skip to content

Latest commit

ย 

History

History
1110 lines (732 loc) ยท 41.9 KB

README.ko.md

File metadata and controls

1110 lines (732 loc) ยท 41.9 KB

GitHub ์น˜ํŠธ ์‹œํŠธ Awesome

Git๊ณผ GitHub์—์„œ ๊ฝค ์œ ์šฉํ•˜์ง€๋งŒ ์ˆจ๊ฒจ์ ธ ์žˆ๋Š” ๊ธฐ๋Šฅ๋“ค์— ๋Œ€ํ•ด ๋‹ค๋ฃน๋‹ˆ๋‹ค. ์ด ์น˜ํŠธ ์‹œํŠธ๋Š” Zach Holman์ด Aloha Ruby Conference 2012์—์„œ ๋ฐœํ‘œํ•œ Git๊ณผ GitHub์˜ ๋น„๋ฐ€๋“ค (์Šฌ๋ผ์ด๋“œ)๊ณผ WDCNZ 2013์—์„œ ๋ฐœํ‘œํ•œ Git๊ณผ GitHub์— ๋Œ€ํ•œ ๋” ๋งŽ์€ ๋น„๋ฐ€๋“ค (์Šฌ๋ผ์ด๋“œ)์—์„œ ์˜๊ฐ์„ ๋ฐ›์•„ ์ž‘์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

๋‹จ์ถ•์ฃผ์†Œ: http://git.io/sheet

Read this in other languages: English, ํ•œ๊ตญ์–ด, ๆ—ฅๆœฌ่ชž, ็ฎ€ไฝ“ไธญๆ–‡, ๆญฃ้ซ”ไธญๆ–‡.

๋ชฉ๋ก

GitHub

Ignore Whitespace

?w=1๋ฅผ diff URL์— ์ถ”๊ฐ€ํ•˜๋ฉด ๋ณ€๊ฒฝ๋œ ์ฝ”๋“œ๋งŒ ๋ณผ ์ˆ˜ ์žˆ๋„๋ก, ๊ณต๋ฐฑ๋งŒ ๋ฐ”๋€ ์ˆ˜์ •์„ ์ œ๊ฑฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Diff without whitespace

GitHub์˜ ๋น„๋ฐ€์„ ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Adjust Tab Space

diff๋‚˜ ํŒŒ์ผ URL์— ?ts=4๋ฅผ ๋ง๋ถ™์ด๋ฉด ํƒญ ๋ฌธ์ž์˜ ํฌ๊ธฐ๋ฅผ ๊ธฐ๋ณธ๊ฐ’์ธ ๊ณต๋ฐฑ 8๊ฐœ ๋Œ€์‹  4๊ฐœ๋กœ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค. ts ๋’ค์˜ ์ˆซ์ž๋Š” ์„ค์ •์— ๋งž๊ฒŒ ๋ณ€๊ฒฝ ํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. gist๋‚˜ raw ํŒŒ์ผ ๋ณด๊ธฐ์—๋Š” ์ ์šฉ ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค๋งŒ, ํฌ๋กฌ ํ™•์žฅ ํ”„๋กœ๊ทธ๋žจ์ด๋‚˜ ์œผ๋กœ ์ž๋™ํ™” ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์—ฌ๊ธฐ์— ์žˆ๋Š” Go ์†Œ์Šค ํŒŒ์ผ์€ ?ts=4๋ฅผ ๋ถ™์ด๊ธฐ ์ „์—๋Š” ์ด๋ ‡์Šต๋‹ˆ๋‹ค.

Before, tab space example

๊ทธ๋ฆฌ๊ณ  ?ts=4๋ฅผ ๋ถ™์ธ ๋‹ค์Œ์—๋Š” ์ด๋ ‡๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

After, tab space example

Commit History by Author

ํŠน์ • ์ปค๋ฏธํ„ฐ๊ฐ€ ํ•œ ๋ชจ๋“  ์ปค๋ฐ‹์„ ๋ณด๊ณ  ์‹ถ๋‹ค๋ฉด URL์— ?author={user}๋ฅผ ์ถ”๊ฐ€ํ•˜์„ธ์š”.

https://github.com/rails/rails/commits/master?author=dhh

DHH commit history

์ปค๋ฐ‹ ๋ทฐ๊ฐ„์˜ ์ฐจ์ด์— ๋Œ€ํ•ด ๋” ์ฝ์–ด๋ณด์„ธ์š”.

Cloning a Repository

์ €์žฅ์†Œ๋ฅผ ํด๋ก ํ•  ๋•Œ, ๋งจ ๋’ค์˜ .git์€ ์ƒ๋žตํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

$ git clone https://github.com/tiimgreen/github-cheat-sheet

Git clone ๋ช…๋ น์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Branch

Compare all Branches to Another Branch

์ €์žฅ์†Œ์˜ ๋ธŒ๋žœ์น˜ ํŽ˜์ด์ง€๋Š”, ์ปค๋ฐ‹ ๋ฒ„ํŠผ์˜ ๋’ค์— ์žˆ์Šต๋‹ˆ๋‹ค.

https://github.com/{user}/{repo}/branches

... ๋ฉ”์ธ ๋ธŒ๋žœ์น˜์— ๋จธ์ง€๋˜์ง€ ์•Š์€ ๋ชจ๋“  ๋ธŒ๋žœ์น˜์˜ ๋ฆฌ์ŠคํŠธ๋ฅผ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์—ฌ๊ธฐ์—์„œ ๋ฒ„ํŠผ ํด๋ฆญ์œผ๋กœ ๋น„๊ต ํŽ˜์ด์ง€์— ์ ‘์†ํ•˜๊ฑฐ๋‚˜ ๋ธŒ๋žœ์น˜๋ฅผ ์‚ญ์ œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Compare branches not merged into master in rails/rails repo - https://github.com/rails/rails/branches

Comparing Branches

GitHub์—์„œ ๋ธŒ๋žœ์น˜ ๋น„๊ต๋ฅผ ํ•˜์‹œ๋ ค๋ฉด, URL์„ ์ด๋Ÿฐ ์‹์œผ๋กœ ๋ฐ”๊พธ์„ธ์š”.

https://github.com/{user}/{repo}/compare/{range}

{range}๋Š” master...4-1-stable๊ณผ ๊ฐ™์ด ์ ์Šต๋‹ˆ๋‹ค.

์˜ˆ๋ฅผ ๋“ค์–ด

https://github.com/rails/rails/compare/master...4-1-stable

Rails branch compare example

{range}๋Š” ์ด๋ ‡๊ฒŒ ์ ์„ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

https://github.com/rails/rails/compare/master@{1.day.ago}...master
https://github.com/rails/rails/compare/master@{2014-10-04}...master

๋‚ ์งœ๋Š” YYYY-MM-DD ํ˜•์‹์œผ๋กœ ์ ์Šต๋‹ˆ๋‹ค

Another compare example

๋ธŒ๋žœ์น˜๋Š” diff๋‚˜ patch ๋ทฐ๋กœ๋„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

https://github.com/rails/rails/compare/master...4-1-stable.diff
https://github.com/rails/rails/compare/master...4-1-stable.patch

์‹œ๊ฐ„์œผ๋กœ ์ปค๋ฐ‹์„ ๋น„๊ตํ•˜๋Š” ๋ฒ•์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Compare branches across forked repositories

ํฌํฌ๋œ ์ €์žฅ์†Œ ๊ฐ„์˜ ๋ธŒ๋žœ์น˜๋ฅผ ๋น„๊ตํ•˜๋ ค๋ฉด URL์„ ์ด๋ ‡๊ฒŒ ๋ณ€๊ฒฝํ•˜์„ธ์š”.

https://github.com/{user}/{repo}/compare/{foreign-user}:{branch}...{own-branch}

์˜ˆ๋ฅผ ๋“ค๋ฉด

https://github.com/rails/rails/compare/byroot:idempotent-counter-caches...master

Forked branch compare

Gists

Gist๋Š” ๋ณธ๊ฒฉ์ ์ธ ์ €์žฅ์†Œ๋ฅผ ๋งŒ๋“ค์ง€ ์•Š๊ณ , ์ž‘์€ ์ฝ”๋“œ ์กฐ๊ฐ๊ณผ ์ผํ•  ์ˆ˜ ์žˆ๋Š” ์‰ฌ์šด ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค.

Gist

์ด๋ ‡๊ฒŒ Gist URL ๋’ค์— .pibb๋ฅผ ๋„ฃ์œผ๋ฉด ๋‹ค๋ฅธ ์‚ฌ์ดํŠธ์— ์ฒจ๋ถ€ํ•  ์ˆ˜ ์žˆ๋Š” HTML ์˜จ๋ฆฌ ๋ฒ„์ „์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Gist๋Š” ์ €์žฅ์†Œ์ฒ˜๋Ÿผ ์ทจ๊ธ‰ํ•  ์ˆ˜ ์žˆ๊ณ  ํด๋ก ๋„ ๋ฉ๋‹ˆ๋‹ค.

$ git clone https://gist.github.com/tiimgreen/10545817

Gists

์ด๋Š” Gists์—์„œ๋„ ์ˆ˜์ •ํ•˜๊ณ  ์—…๋ฐ์ดํŠธ๋ฅผ ํ‘ธ์‹œํ•  ์ˆ˜ ์žˆ๋‹ค๋Š” ์˜๋ฏธ์ž…๋‹ˆ๋‹ค.

$ git commit
$ git push
Username for 'https://gist.github.com':
Password for 'https://tiimgreen@gist.github.com':

ํ•˜์ง€๋งŒ, Gists๋Š” ๋””๋ ‰ํ„ฐ๋ฆฌ๋ฅผ ์ง€์›ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋ชจ๋“  ํŒŒ์ผ์€ ์ €์žฅ์†Œ์˜ ๋ฃจํŠธ์— ๋„ฃ์„ ํ•„์š”๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. Gist๋ฅผ ๋งŒ๋“œ๋Š” ๋ฒ•์— ๋Œ€ํ•ด ๋” ์ฝ์–ด๋ณด์„ธ์š”.

Git.io

Git.io๋Š” GitHub๋ฅผ ์œ„ํ•œ ๊ฐ„๋‹จํ•œ URL ๋‹จ์ถ•๊ธฐ์ž…๋‹ˆ๋‹ค.

Git.io

Curl์œผ๋กœ ์ˆœ์ˆ˜ HTTP๋ฅผ ํ†ตํ•ด ์‚ฌ์šฉํ•˜์‹ค ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

$ curl -i http://git.io -F "url=https://github.com/..."
HTTP/1.1 201 Created
Location: http://git.io/abc123

$ curl -i http://git.io/abc123
HTTP/1.1 302 Found
Location: https://github.com/...

Git.io์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Keyboard Shortcuts

์ €์žฅ์†Œ ํŽ˜์ด์ง€์—์„œ ๋‹จ์ถ•ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์‰ฝ๊ฒŒ ์ด๋™ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • t๋ฅผ ๋ˆ„๋ฅด๋ฉด ํŒŒ์ผ ํƒ์ƒ‰ ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.
  • w๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋ธŒ๋žœ์น˜ ์„ ํƒ ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.
  • s๋ฅผ ๋ˆ„๋ฅด๋ฉด ํ˜„์žฌ ์ €์žฅ์†Œ์˜ ๊ฒ€์ƒ‰์ฐฝ์œผ๋กœ ํฌ์ปค์Šค๊ฐ€ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค. ๋ฐฑ์ŠคํŽ˜์ด์Šค๋ฅผ ๋ˆ„๋ฅด๋ฉด ์ฑ„์›Œ์ ธ ์žˆ๋Š” "This repository"๋ฅผ ์ง€์›Œ GitHub ์ „์ฒด์—์„œ ๊ฒ€์ƒ‰ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
  • l์„ ๋ˆ„๋ฅด๋ฉด ์ด์Šˆ์˜ ๋ผ๋ฒจ์„ ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ํŒŒ์ผ์„ ๋ณด๊ณ  ์žˆ์„ ๋•Œ (์˜ˆ๋ฅผ ๋“ค์–ด https://github.com/tiimgreen/github-cheat-sheet/blob/master/README.md) y๋ฅผ ๋ˆ„๋ฅด๋ฉด URL์„ ์ง€๊ธˆ ๋ณด๊ณ  ์žˆ๋Š” ํŽ˜์ด์ง€๋ฅผ ์‚ฌ์‹ค์ƒ ๊ณ ์ •ํ•˜๋„๋ก ํ•ฉ๋‹ˆ๋‹ค. ์ฝ”๋“œ๊ฐ€ ๋ฐ”๋€๋‹ค๊ณ  ํ•ด๋„ ์ด๋ฒˆ์— ๋ณธ ๋‚ด์šฉ์„ ๋‹ค์‹œ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ง€๊ธˆ ํŽ˜์ด์ง€์—์„œ ์“ธ ์ˆ˜ ์žˆ๋Š” ๋ชจ๋“  ๋‹จ์ถ•ํ‚ค๋ฅผ ๋ณด์‹œ๋ ค๋ฉด ?๋ฅผ ๋ˆ„๋ฅด์„ธ์š”.

Keyboard shortcuts

์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒ€์ƒ‰ ๋ฌธ๋ฒ•์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Line Highlighting in Repos

์ฝ”๋“œ ํŒŒ์ผ URL์˜ ๋์— #L52๋ฅผ ์ถ”๊ฐ€ํ•˜๊ฑฐ๋‚˜ ์ค„ ๋ฒˆํ˜ธ๋ฅผ ํด๋ฆญํ•˜๋ฉด ๊ทธ ์ค„ ๋ฒˆํ˜ธ๋ฅผ ํ•˜์ด๋ผ์ดํŠธํ•ฉ๋‹ˆ๋‹ค.

#L53-L60์ฒ˜๋Ÿผ ๋ฒ”์œ„ ์ง€์ •๋„ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ๋ฒ”์œ„๋ฅผ ์ง€์ •ํ•˜๋ ค๋ฉด shiftํ‚ค๋ฅผ ๋ˆ„๋ฅธ ์ฑ„ ๋‘ ๋ผ์ธ์„ ํด๋ฆญํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.

https://github.com/rails/rails/blob/master/activemodel/lib/active_model.rb#L53-L60

Line Highlighting

Closing Issues with Commits

์–ด๋–ค ์ปค๋ฐ‹์ด ์ด์Šˆ๋ฅผ ๊ณ ์ณค๋‹ค๋ฉด, fix/fixes/fixed, close/closes/closed, resolve/resolves/resolved๋ฅผ ํ‚ค์›Œ๋“œ๋กœ ํ•ด๋‹น ์ด์Šˆ๊ฐ€ ๋งˆ์Šคํ„ฐ ๋ธŒ๋žœ์น˜์— ์ปค๋ฐ‹ ๋  ๋•Œ ๋‹ซ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

$ git commit -m "Fix screwup, fixes #12"

์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ์ด์Šˆ๋ฅผ ๋‹ซ๊ณ  ํด๋กœ์ง• ์ปค๋ฐ‹์œผ๋กœ ์ฐธ์กฐํ•˜๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค.

Closing Repo

์ปค๋ฐ‹ ๋ฉ”์‹œ์ง€๋กœ ์ด์Šˆ ๋‹ซ๊ธฐ์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Cross-Link Issues

๊ฐ™์€ ์ €์žฅ์†Œ์˜ ๋‹ค๋ฅธ ์ด์Šˆ๋ฅผ ๋งํฌํ•˜๊ธฐ ์›ํ•œ๋‹ค๋ฉด, # ๋’ค์— ์ด์Šˆ ๋ฒˆํ˜ธ๋งŒ ์ž…๋ ฅํ•˜์‹œ๋ฉด ์ž๋™์œผ๋กœ ๋งํฌ๋ฉ๋‹ˆ๋‹ค.

๋‹ค๋ฅธ ์ €์žฅ์†Œ์˜ ์ด์Šˆ๋ฅผ ๋งํฌํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด {user}/{repo}#์ด์Šˆ_๋ฒˆํ˜ธ๋กœ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. (์˜ˆ tiimgreen/toc#12)

Cross-Link Issues

Locking Conversations

ํ’€ ๋ฆฌํ€˜์ŠคํŠธ์™€ ์ด์Šˆ๋Š” ์ €์žฅ์†Œ์˜ ์ฃผ์ธ์ด๋‚˜ ํ˜‘์—…์ž๊ฐ€ ์ž ๊ธ€ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Lock conversation

์ด๋Š” ํ”„๋กœ์ ํŠธ์˜ ํ˜‘์—…์ž๊ฐ€ ์•„๋‹Œ ์‚ฌ๋žŒ์€ ๋” ์ด์ƒ ๋Œ“๊ธ€์„ ๋‹ฌ ์ˆ˜ ์—†๊ฒŒ ๋œ๋‹ค๋Š” ๋ง์ž…๋‹ˆ๋‹ค.

Comments locked

๋Œ€ํ™” ์ž ๊ทธ๊ธฐ์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

CI Status on Pull Requests

์ •ํ™•ํžˆ ์„ค์ •๋˜์—ˆ๋‹ค๋ฉด, ํ’€ ๋ฆฌํ€˜์ŠคํŠธ๋ฅผ ๋ฐ›๊ฑฐ๋‚˜ ํ’€ ๋ฆฌํ€˜์ŠคํŠธ์— ์ƒˆ๋กœ์šด ์ปค๋ฐ‹์„ ํ•  ๋•Œ๋งˆ๋‹ค, Travis CI๊ฐ€ ํ’€ ๋ฆฌํ€˜์ŠคํŠธ๋ฅผ ๋นŒ๋“œ ํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค. Travis CI ์‹œ์ž‘ํ•˜๊ธฐ๋ฅผ ์ข€ ๋” ์ฝ์–ด๋ณด์„ธ์š”.

Travis CI status

์ปค๋ฐ‹ ์ƒํƒœ API์— ๋Œ€ํ•ด ์ข€ ๋” ์ฝ์–ด๋ณด์„ธ์š”.

Filters

์ด์Šˆ, ํ’€ ๋ฆฌํ€˜์ŠคํŠธ ๋‘˜ ๋‹ค ์œ ์ € ์ธํ„ฐํŽ˜์ด์Šค์—์„œ ํ•„ํ„ฐ๋ง์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

๋ ˆ์ผ์Šค ์ €์žฅ์†Œ https://github.com/rails/rails/issues์—์„œ, "activerecord" ๋ผ๋ฒจ์„ ์„ ํƒํ•˜์—ฌ ๋‹ค์Œ ํ•„ํ„ฐ๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

is:issue label:activerecord

ํ•˜์ง€๋งŒ, activerecord ๋ผ๋ฒจ์ด ์—†๋Š” ๋ชจ๋“  ์ด์Šˆ๋ฅผ ์ฐพ์„ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

is:issue -label:activerecord

๋ง๋ถ™์—ฌ, ํ’€ ๋ฆฌํ€˜์ŠคํŠธ์—๋„ ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค.

is:pr -label:activerecord

GitHub๋Š” ์—ด๋ฆฌ๊ฑฐ๋‚˜ ๋‹ซํžŒ ์ด์Šˆ์™€ ํ’€ ๋ฆฌํ€˜์ŠคํŠธ๋ฅผ ์œ„ํ•œ ํƒญ์ด ์žˆ์Šต๋‹ˆ๋‹ค๋งŒ ๋จธ์ง€๋œ ํ’€ ๋ฆฌํ€˜์ŠคํŠธ๋„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์Œ ํ•„ํ„ฐ๋ฅผ ์ž…๋ ฅํ•˜๊ธฐ๋งŒ ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.

is:merged

์ด์Šˆ ๊ฒ€์ƒ‰์— ๋Œ€ํ•ด ์ข€ ๋” ์ฝ์–ด๋ณด์„ธ์š”.

๋งˆ์ง€๋ง‰์œผ๋กœ ์ด์ œ ์ƒํƒœ API์˜ ์ƒํƒœ์— ์˜ํ•œ ํ•„ํ„ฐ๋„ ๊ฐ€๋Šฅํ•ด์กŒ์Šต๋‹ˆ๋‹ค.

์„ฑ๊ณต ์ƒํƒœ์˜ ํ’€ ๋ฆฌํ€˜์ŠคํŠธ๋Š” ์ด๋ ‡๊ฒŒ ๊ฒ€์ƒ‰ํ•ฉ๋‹ˆ๋‹ค.

status:success

์ƒํƒœ API ๊ฒ€์ƒ‰์— ๋Œ€ํ•ด ์ข€ ๋” ์ฝ์–ด๋ณด์„ธ์š”.

Syntax Highlighting in Markdown Files

๋งˆํฌ๋‹ค์šด์—์„œ ์˜ˆ๋ฅผ ๋“ค์–ด, ๋ฃจ๋น„ ์ฝ”๋“œ๋ฅผ ์‹ ํ…์Šค ํ•˜์ด๋ผ์ดํŠธ ํ•˜๋ ค๋ฉด ์ด๋ ‡๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค.

```ruby
require 'tabbit'
table = Tabbit.new('Name', 'Email')
table.add_row('Tim Green', 'tiimgreen@gmail.com')
puts table.to_s
```

์ด๋ ‡๊ฒŒ ๋ณด์ž…๋‹ˆ๋‹ค.

require 'tabbit'
table = Tabbit.new('Name', 'Email')
table.add_row('Tim Green', 'tiimgreen@gmail.com')
puts table.to_s

GitHub๋Š” Linguist๋ฅผ ์‚ฌ์šฉํ•ด ์–ธ์–ด๋ฅผ ๊ฐ์ง€ํ•˜๊ณ  ์‹ ํƒ์Šค๋ฅผ ํ•˜์ด๋ผ์ดํŠธํ•ฉ๋‹ˆ๋‹ค. ์–ธ์–ด YAML ํŒŒ์ผ์„ ์ •๋…ํ•˜์‹œ๋ฉด ์–ด๋–ค ํ‚ค์›Œ๋“œ๊ฐ€ ์œ ํšจํ•œ์ง€ ํ™•์ธํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

GitHub Flavored ๋งˆํฌ๋‹ค์šด์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Emojis

์—๋ชจ์ง€๋Š” ํ’€ ๋ฆฌํ€˜์ŠคํŠธ, ์ด์Šˆ, ์ปค๋ฐ‹ ๋ฉ”์‹œ์ง€, ์ €์žฅ์†Œ ์„ค๋ช… ๋“ฑ์— :์—๋ชจ์ง€์˜_์ด๋ฆ„:์œผ๋กœ ๋„ฃ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

GitHub์—์„œ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์—๋ชจ์ง€์˜ ์ „ ๋ชฉ๋ก์€ emoji-cheat-sheet.com๋‚˜ scotch-io/All-GitHub-Emoji-Icons์—์„œ ํ™•์ธํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํŽธ๋ฆฌํ•œ ์—๋ชจ์ง€ ๊ฒ€์ƒ‰ ์—”์ง„์€ emoji.muan.co์— ์žˆ์Šต๋‹ˆ๋‹ค.

GitHub์—์„œ ๋งŽ์ด ์‚ฌ์šฉํ•˜๋Š” ์—๋ชจ์ง€ ํƒ‘ 5์œ„๋Š” ์ด๋ ‡์Šต๋‹ˆ๋‹ค.

  1. :shipit:
  2. :sparkles:
  3. :-1:
  4. :+1:
  5. :clap:

Images/GIFs

๋Œ“๊ธ€์ด๋‚˜ README ๋“ฑ์— ์ด๋ฏธ์ง€์™€ GIF๋ฅผ ๋„ฃ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

![Alt Text](http://www.sheawong.com/wp-content/uploads/2013/08/keephatin.gif)

์ €์žฅ์†Œ์— ์žˆ๋Š” ์ด๋ฏธ์ง€๋Š” ์ง์ ‘ ๋ถˆ๋Ÿฌ์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

![Alt Text](https://github.com/{user}/{repo}/raw/master/path/to/image.gif)

Peter don't care

๋ชจ๋“  ์ด๋ฏธ์ง€๋Š” GitHub์—์„œ ์บ์‹œํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ํ˜ธ์ŠคํŠธ๊ฐ€ ์ฃฝ์–ด๋„ ์ด๋ฏธ์ง€๋Š” ์—ฌ์ „ํžˆ ๋‚จ์Šต๋‹ˆ๋‹ค.

Embedding Images in GitHub Wiki

์ด๋ฏธ์ง€๋ฅผ ์œ„ํ‚ค ํŽ˜์ด์ง€์— ๋„ฃ๋Š” ๋ฐฉ๋ฒ•์€ ์—ฌ๋Ÿฟ ์žˆ์Šต๋‹ˆ๋‹ค. ์œ„์— ๋ณด์ด๋Š” ์ผ๋ฐ˜ ๋งˆํฌ๋‹ค์šด ๋ฌธ๋ฒ•๋„ ์žˆ์ง€๋งŒ, ์ด๋ฏธ์ง€์— ๋†’์ด์™€ ๋„“์ด๋ฅผ ์ง€์ •ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฌธ๋ฒ•๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

[[ http://www.sheawong.com/wp-content/uploads/2013/08/keephatin.gif | height = 100px ]]

์ด๋ ‡๊ฒŒ ๋ณด์ž…๋‹ˆ๋‹ค.

Just a screenshot

Quick Quoting

์Šค๋ ˆ๋“œ์— ๋‹ต๊ธ€์„ ๋‹ฌ ๋•Œ ์ „์— ๋ˆ„๊ฐ€ ๋งํ•œ ์–ด๋–ค ๋‚ด์šฉ์„ ์ธ์šฉํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด, ํ…์ŠคํŠธ๋ฅผ ํ•˜์ด๋ผ์ดํŠธํ•˜๊ณ  r์„ ๋ˆ„๋ฅด์„ธ์š”. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ๋‚ด์šฉ์„ ํ…์ŠคํŠธ ๋ฐ•์Šค์— ์ธ์šฉ ํฌ๋งท์œผ๋กœ ๋ณต์‚ฌํ•ด ์ค๋‹ˆ๋‹ค.

Quick Quote

๋น ๋ฅธ ์ธ์šฉ์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Pasting Clipboard Image to Comments

(ํฌ๋กฌ์—์„œ๋งŒ ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค)

์Šคํฌ๋ฆฐ์ƒท์„ ์ฐ๊ณ  ํด๋ฆฝ๋ณด๋“œ์— ๋ณต์‚ฌํ•œ ๊ฒฝ์šฐ (mac: cmd-ctrl-shift-4), ๊ฐ„๋‹จํžˆ ์ด๋ฏธ์ง€๋ฅผ ๋Œ“๊ธ€ ์˜์—ญ์— ๋ถ™์—ฌ๋„ฃ์„(cmd-v / ctrl-v) ์ˆ˜ ์žˆ๊ณ  ์ด๋Š” ์ž๋™์œผ๋กœ GitHub์— ์—…๋กœ๋“œ ๋ฉ๋‹ˆ๋‹ค.

Pasting Clipboard Image to Comments

issue attachments์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Quick Licensing

์ €์žฅ์†Œ๋ฅผ ๋งŒ๋“ค ๋•Œ, GitHub๋Š” ๋งŒ๋“ค์–ด์ง„ ์ €์ž‘๊ถŒ์„ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ๋Š” ์˜ต์…˜์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

License

์ด๋ฏธ ์žˆ๋Š” ์ €์žฅ์†Œ์—๋„ ์›น ์ธํ„ฐํŽ˜์ด์Šค์—์„œ ์ƒˆ ํŒŒ์ผ์„ ๋งŒ๋“ค์–ด ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฆ„์— LICENSE๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ์˜ต์…˜์œผ๋กœ ํ…œํ”Œ๋ฆฟ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

License

.gitignore์—๋„ ๋˜‘๊ฐ™์ด ์ ์šฉ๋ฉ๋‹ˆ๋‹ค.

์˜คํ”ˆ ์†Œ์Šค ์ €์ž‘๊ถŒ์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Task Lists

์ด์Šˆ์™€ ํ’€ ๋ฆฌํ€˜์ŠคํŠธ์—์„œ ์•„๋ž˜์˜ ๋ฌธ๋ฒ•์œผ๋กœ ์ฒดํฌ๋ฐ•์Šค๋ฅผ ๋„ฃ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.(์ŠคํŽ˜์ด์Šค์— ์ฃผ์˜ํ•˜์„ธ์š”.)

- [ ] Be awesome
- [ ] Prepare dinner
  - [ ] Research recipe
  - [ ] Buy ingredients
  - [ ] Cook recipe
- [ ] Sleep

Task List

์ฒดํฌ๋ฐ•์Šค๋ฅผ ํด๋ฆญํ•˜๋ฉด, ์ˆœ์ˆ˜ ๋งˆํฌ๋‹ค์šด์—์„œ ๊ฐฑ์‹ ์ด ์ด๋ฃจ์–ด์ง‘๋‹ˆ๋‹ค.

- [x] Be awesome
- [ ] Prepare dinner
  - [x] Research recipe
  - [x] Buy ingredients
  - [ ] Cook recipe
- [ ] Sleep

ํ•  ์ผ ๋ชฉ๋ก์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Task Lists in Markdown Documents

์ด์ œ ๋งˆํฌ๋‹ค์šด ๋ฌธ์„œ์—์„œ ์ฝ๊ธฐ ์ „์šฉ ์ฒดํฌ๋ฆฌ์ŠคํŠธ๋ฅผ ๋„ฃ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

- [ ] Mercury
- [x] Venus
- [x] Earth
  - [x] Moon
- [x] Mars
  - [ ] Deimos
  - [ ] Phobos
  • Mercury
  • Venus
  • Earth
    • Moon
  • Mars
    • Deimos
    • Phobos

๋งˆํฌ๋‹ค์šด ๋ฌธ์„œ์—์„œ์˜ ํ•  ์ผ ๋ชฉ๋ก์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Relative Links

์ƒ๋Œ€ ๊ฒฝ๋กœ ๋งํฌ๋Š” ๋งˆํฌ๋‹ค์šด ํŒŒ์ผ์ด ๋‚ด๋ถ€ ์ฝ˜ํ…์ธ ๋กœ ๋งํฌ๋  ๋•Œ ์ถ”์ฒœํ•ฉ๋‹ˆ๋‹ค.

[Link to a header](#awesome-section)
[Link to a file](docs/readme)

์ ˆ๋Œ€ ๊ฒฝ๋กœ ๋งํฌ๋Š” URL์ด ๋ณ€๊ฒฝ ๋  ๋•Œ๋งˆ๋‹ค ๋ณ€๊ฒฝํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. (์˜ˆ๋ฅผ ๋“ค์–ด ์ €์žฅ์†Œ ์ด๋ฆ„ ๋ณ€๊ฒฝ, ์•„์ด๋”” ๋ณ€๊ฒฝ, ํ”„๋กœ์ ํŠธ ํฌํฌ) ์ƒ๋Œ€ ๊ฒฝ๋กœ ๋งํฌ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋ฌธ์„œ๋ฅผ ์‰ฝ๊ฒŒ ์Šค์Šค๋กœ ๋…๋ฆฝ์ ์œผ๋กœ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ƒ๋Œ€ ๊ฒฝ๋กœ ๋งํฌ์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Metadata and Plugin Support for GitHub Pages

์ง€ํ‚ฌ๋กœ ์ž‘์„ฑ๋œ ํŽ˜์ด์ง€์™€ ํฌ์ŠคํŠธ์—์„œ, ์ €์žฅ์†Œ ์ •๋ณด๋Š” ์˜ˆ๋ฅผ ๋“ค์–ด {{ site.github.project_title }}์ฒ˜๋Ÿผ site.github ์ด๋ฆ„ ๊ณต๊ฐ„์œผ๋กœ ์‚ฌ์šฉํ•˜๊ณ  ํ‘œ์‹œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Jemoji์™€ jekyll-mentions ํ”Œ๋Ÿฌ๊ทธ์ธ์€ github.com์—์„œ์ฒ˜๋Ÿผ emoji์™€ @mentions๋ฅผ ์ง€ํ‚ฌ ํฌ์ŠคํŠธ์™€ ํŽ˜์ด์ง€์—์„œ ์‚ฌ์šฉํ•˜๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค.

์ €์žฅ์†Œ ๋ฉ”ํƒ€ ๋ฐ์ดํ„ฐ์™€ GitHub ํŽ˜์ด์ง€์˜ ํ”Œ๋Ÿฌ๊ทธ์ธ ์ง€์›์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Viewing YAML Metadata in your Documents

Jekyll์ด๋‚˜ GitHub Pages ๊ฐ™์€ ๋งŽ์€ ๋ธ”๋กœ๊ทธ์—์„œ ํฌ์ŠคํŠธ์˜ ์ฒ˜์Œ์— YAML ํฌ๋ฉง์˜ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ๋ฅผ ํ•„์š”๋กœ ํ•ฉ๋‹ˆ๋‹ค. GitHub๋Š” ์ด ๋ฉ”ํƒ€ ์ •๋ณด๋ฅผ ์ฝ๊ธฐ ํŽธํ•˜๊ฒŒ ํ…Œ์ด๋ธ”๋กœ ํ‘œ์‹œํ•ด ์ค๋‹ˆ๋‹ค.

YAML metadata

๋ฌธ์„œ์—์„œ YAML ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ ๋ณด๊ธฐ์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Rendering Tabular Data

GitHub๋Š” .csv(comma-separated)์™€ .tsv(tab-separated) ํŒŒ์ผ์— ๋Œ€ํ•ด ํ‘œ(tabular) ๋ฐ์ดํ„ฐ ๋ณด๊ธฐ๋ฅผ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.

Tabular data

ํ‘œ ๋ฐ์ดํ„ฐ ํ‘œ์‹œ์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Rendering PDF

GitHub์—์„œ PDF๋ฅผ ๋ Œ๋”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

PDF

PDF ๋ Œ๋”๋ง์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Revert a Pull Request

ํ’€ ๋ฆฌํ€˜์ŠคํŠธ๊ฐ€ ๋จธ์ง€๋œ ํ›„์—, ์•„๋ฌด ๋„์›€์ด ์•ˆ๋˜๊ฑฐ๋‚˜ ๋จธ์ง€๊ฐ€ ์ž˜๋ชป๋œ ๊ฒฐ์ •์ด์—ˆ๋‹ค๋Š” ๊ฑธ ๋ˆˆ์น˜ ์ฑŒ ๋•Œ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

ํ’€ ๋ฆฌํ€˜์ŠคํŠธ ํŽ˜์ด์ง€์˜ ์ปค๋ฐ‹์˜ ์˜ค๋ฅธ์ชฝ์— ์žˆ๋Š” Revert ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด ์ด ํ’€ ๋ฆฌํ€˜์ŠคํŠธ๋ฅผ ๋˜๋Œ๋ฆฌ๋Š” ํ’€ ๋ฆฌํ€˜์ŠคํŠธ๋ฅผ ๋งŒ๋“ค์–ด ๋˜๋Œ๋ฆด ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Revert button

ํ’€ ๋ฆฌํ€˜์ŠคํŠธ ๋˜๋Œ๋ฆฌ๊ธฐ์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Diffs

Rendered Prose Diffs

GitHub์—์„œ ์ง€์›ํ•˜๋Š” ์‚ฐ๋ฌธ(prose) ํŒŒ์ผ(์˜ˆ๋ฅผ ๋“ค์–ด Markdown)์ด ์žˆ๋Š” ์ปค๋ฐ‹๊ณผ ํ’€ ๋ฆฌํ€˜์ŠคํŠธ์—์„œ๋Š” source์™€ rendered ๋ทฐ ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Source / Rendered view

"rendered" ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜์‹œ๋ฉด ๋ Œ๋”๋œ ๋ฌธ์„œ์—์„œ ๋ณ€๊ฒฝ์„ ํ™•์ธํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ Œ๋”๋œ ์‚ฐ๋ฌธ(prose) ๋ทฐ๋Š” ๋ฌธ์žฅ์„ ์ถ”๊ฐ€, ์‚ญ์ œ, ๋ณ€๊ฒฝํ–ˆ์„ ๋•Œ ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค.

Rendered Prose Diffs

๋ Œ๋”๋œ ์‚ฐ๋ฌธ(prose) diff์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Diffable Maps

์ง€์˜ค๋ฐ์ดํ„ฐ๊ฐ€ ํฌํ•จ๋œ ์ปค๋ฐ‹์ด๋‚˜ ํ’€ ๋ฆฌํ€˜์ŠคํŠธ๋ฅผ ๋ณผ ๋•Œ๋งˆ๋‹ค GitHub๋Š” ๋ฌด์—‡์ด ๋ณ€๊ฒฝ ๋˜์—ˆ๋Š”์ง€ ์‹œ๊ฐ์ ์œผ๋กœ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.

Diffable Maps

diff ๊ฐ€๋Šฅํ•œ ๋งต์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Expanding Context in Diffs

diff์˜ ๋‹ซ์•„๋‘” ๊ณณ์˜ ํŽผ์นจ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด, ๋ฌธ๋งฅ์„ ๋” ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ „์ฒด ํŒŒ์ผ์„ ํ‘œ์‹œํ•  ๋•Œ๊นŒ์ง€ ๊ณ„์† ํŽผ์น  ์ˆ˜ ์žˆ์œผ๋ฉฐ, GitHub์—์„œ diff๊ฐ€ ํ‘œ์‹œ๋˜๋Š” ์žฅ์†Œ๋ผ๋ฉด ์–ด๋””์„œ๋“  ์‚ฌ์šฉ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

Expanding Context in Diffs

diff์—์„œ์˜ ๋ฌธ๋งฅ ํ™•์žฅ์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Diff or Patch of Pull Request

URL ๋’ค์— .diff๋‚˜ .patch๋ฅผ ๋ถ™์ด๋ฉด ํ’€ ๋ฆฌํ€˜์ŠคํŠธ์˜ diff๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค๋ฉด

https://github.com/tiimgreen/github-cheat-sheet/pull/15
https://github.com/tiimgreen/github-cheat-sheet/pull/15.diff
https://github.com/tiimgreen/github-cheat-sheet/pull/15.patch

.diff ํ™•์žฅ์ž๋Š” ์ด๋Ÿฐ ๋‚ด์šฉ์˜ ํ‰๋ฒ”ํ•œ(plain) ํ…์ŠคํŠธ๋ฅผ ์ค๋‹ˆ๋‹ค.

diff --git a/README.md b/README.md
index 88fcf69..8614873 100644
--- a/README.md
+++ b/README.md
@@ -28,6 +28,7 @@ All the hidden and not hidden features of Git and GitHub. This cheat sheet was i
 - [Merged Branches](#merged-branches)
 - [Quick Licensing](#quick-licensing)
 - [TODO Lists](#todo-lists)
+- [Relative Links](#relative-links)
 - [.gitconfig Recommendations](#gitconfig-recommendations)
     - [Aliases](#aliases)
     - [Auto-correct](#auto-correct)
@@ -381,6 +382,19 @@ When they are clicked, they will be updated in the pure Markdown:
 - [ ] Sleep

(...)

Rendering and diffing images

GitHub๋Š” PNG, JPG, GIF, PSD๋ฅผ ํฌํ•จํ•œ ์—ฌ๋Ÿฌ ์ผ๋ฐ˜์ ์ธ ์ด๋ฏธ์ง€ ํ˜•์‹์„ ํ‘œ์‹œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ถ”๊ฐ€์ ์œผ๋กœ ์ด๋ฏธ์ง€ ํ˜•์‹์˜ diff๋ฅผ ํ‘œ์‹œํ•˜๋Š” ์—ฌ๋Ÿฌ ๋ฐฉ๋ฒ•์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

[Diffable PSD](https://github.com/blog/1845-psd-viewing-diffing

์ด๋ฏธ์ง€ diff์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Hub

Hub๋Š” GitHub๋ฅผ ์ข€ ๋” ์‰ฝ๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ์ถ”๊ฐ€ ๊ธฐ๋Šฅ ๋ฐ ๋ช…๋ น์„ ์ œ๊ณตํ•˜๋Š” ์ปค๋งจ๋“œ ๋ผ์ธ Git ๋ž˜ํผ์ž…๋‹ˆ๋‹ค.

์ด๋ ‡๊ฒŒ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

$ hub clone tiimgreen/toc

Hub๊ฐ€ ์ œ๊ณตํ•˜๋Š” ๋” ๋ฉ‹์ง„ ๊ธฐ๋Šฅ๋“ค์„ ํ™•์ธํ•ด ๋ณด์„ธ์š”.

Contribution Guidelines

GitHub๋Š” ํ”„๋กœ์ ํŠธ์— ๊ธฐ์—ฌํ•˜๋Š” ์‚ฌ์šฉ์ž๋ฅผ ์œ„ํ•œ ์„ธ ๊ฐ€์ง€ ๊ฐ๊ธฐ ๋‹ค๋ฅธ ํŒŒ์ผ์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. ์ด ํŒŒ์ผ์€ ์ €์žฅ์†Œ์˜ ์ œ์ผ ์œ„๋‚˜ ๊ทธ ์•„๋ž˜์˜ .github ๋””๋ ‰ํ„ฐ๋ฆฌ์— ์œ„์น˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

CONTRIBUTING File

์ €์žฅ์†Œ์˜ ์ œ์ผ ์œ„๋‚˜ ๊ทธ ์•„๋ž˜์˜ .github ๋””๋ ‰ํ„ฐ๋ฆฌ์— CONTRIBUTING์ด๋‚˜ CONTRIBUTING.md ํŒŒ์ผ์„ ๋„ฃ์–ด๋‘๋ฉด ๊ธฐ์—ฌ์ž๊ฐ€ ์ด์Šˆ๋ฅผ ๋งŒ๋“ค๊ฑฐ๋‚˜ ํ’€ ๋ฆฌํ€˜์ŠคํŠธ๋ฅผ ๋งŒ๋“ค ๋•Œ ๋งํฌ๋กœ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.

Contributing Guidelines

๊ธฐ์—ฌํ•˜๊ธฐ์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

ISSUE_TEMPLATE file

ํ”„๋กœ์ ํŠธ์˜ ์ƒˆ๋กœ์šด ์ด์Šˆ์— ์‚ฌ์šฉ๋  ํ…œํ”Œ๋ฆฟ์„ ์ง€์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž๊ฐ€ ์ƒˆ ์ด์Šˆ๋ฅผ ์ƒ์„ฑํ•˜๋ฉด ์ด์Šˆ ์ฐฝ์ด ์ด ํŒŒ์ผ์˜ ๋‚ด์šฉ์œผ๋กœ ์ฑ„์›Œ์ง‘๋‹ˆ๋‹ค. ์ €์žฅ์†Œ์˜ ์ œ์ผ ์œ„๋‚˜ ๊ทธ ์•„๋ž˜์˜ .github ๋””๋ ‰ํ„ฐ๋ฆฌ์— ISSUE_TEMPLATE์ด๋‚˜ ISSUE_TEMPLATE.md ํŒŒ์ผ์„ ๋„ฃ์–ด ๋‘์„ธ์š”.

์ด์Šˆ ํ…œํ”Œ๋ฆฟ์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

์ด์Šˆ ํ…œํ”Œ๋ฆฟ ํŒŒ์ผ ์ƒ์„ฑ๊ธฐ

GitHub Issue template

PULL_REQUEST_TEMPLATE file

ํ”„๋กœ์ ํŠธ์˜ ์ƒˆ๋กœ์šด ํ’€ ๋ฆฌํ€˜์ŠคํŠธ์— ์‚ฌ์šฉ๋  ํ…œํ”Œ๋ฆฟ์„ ์ง€์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž๊ฐ€ ์ƒˆ ํ’€ ๋ฆฌํ€˜์ŠคํŠธ๋ฅผ ์ƒ์„ฑํ•˜๋ฉด ํ…์ŠคํŠธ ์˜์—ญ์ด ์ด ํŒŒ์ผ์˜ ๋‚ด์šฉ์œผ๋กœ ์ฑ„์›Œ์ง‘๋‹ˆ๋‹ค. ์ €์žฅ์†Œ์˜ ์ œ์ผ ์œ„๋‚˜ .github ๋””๋ ‰ํ„ฐ๋ฆฌ์— PULL_REQUEST_TEMPLATE์ด๋‚˜ PULL_REQUEST_TEMPLATE.md ํŒŒ์ผ์„ ๋„ฃ์–ด ๋‘์„ธ์š”.

ํ’€ ๋ฆฌํ€˜์ŠคํŠธ ํ…œํ”Œ๋ฆฟ์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

ํ’€ ๋ฆฌํ€˜์ŠคํŠธ ํ…œํ”Œ๋ฆฟ ํŒŒ์ผ ์ƒ์„ฑ๊ธฐ

Octicons

GitHub ์•„์ด์ฝ˜(์˜ฅํ‹ฐ์ฝ˜)์ด ์ด์ œ ์˜คํ”ˆ์†Œ์Šค๊ฐ€ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

Octicons

GitHub ์˜ฅํ‹ฐ์ฝ˜์— ๋Œ€ํ•ด ๋” ์ฝ์–ด๋ณด์„ธ์š”.

GitHub Resources

Title Link
GitHub Explore https://github.com/explore
GitHub Blog https://github.com/blog
GitHub Help https://help.github.com/
GitHub Training https://training.github.com/
GitHub Developer https://developer.github.com/
GitHub Education (Free Micro Account and other stuff for students) https://education.github.com/

GitHub Talks

Title Link
How GitHub Uses GitHub to Build GitHub https://www.youtube.com/watch?v=qyz3jkOBbQY
Introduction to Git with Scott Chacon of GitHub https://www.youtube.com/watch?v=ZDR433b0HJY
How GitHub No Longer Works https://www.youtube.com/watch?v=gXD1ITW7iZI
Git and GitHub Secrets https://www.youtube.com/watch?v=Foz9yvMkvlA
More Git and GitHub Secrets https://www.youtube.com/watch?v=p50xsL-iVgU

Git

Remove All Deleted Files from the Working Tree

/bin/rm์„ ์‚ฌ์šฉํ•ด ๋Œ€๋Ÿ‰์˜ ํŒŒ์ผ์„ ์ง€์šธ ๋•Œ, ํ•˜๋‚˜์”ฉ ์ œ๊ฑฐํ•  ํ•„์š” ์—†์ด ๋ฐ‘์˜ ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•ด ์ž‘์—… ๋””๋ ‰ํ„ฐ๋ฆฌ์™€ ์ธ๋ฑ์Šค์—์„œ ์ง€์šธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

$ git rm $(git ls-files -d)

์˜ˆ๋ฅผ ๋“ค์–ด

$ git status
On branch master
Changes not staged for commit:
	deleted:    a
	deleted:    c

$ git rm $(git ls-files -d)
rm 'a'
rm 'c'

$ git status
On branch master
Changes to be committed:
	deleted:    a
	deleted:    c

Previous Branch

Git์—์„œ ์ด์ „ ๋ธŒ๋žœ์น˜๋กœ ๋Œ์•„๊ฐ€๋Š” ๊ฑด ์ด๋ ‡๊ฒŒ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

$ git checkout -
# Switched to branch 'master'

$ git checkout -
# Switched to branch 'next'

$ git checkout -
# Switched to branch 'master'

Git ๋ธŒ๋žœ์น˜์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Stripspace

Git Stripspace๋Š” ์ด๋Ÿฐ ์ผ์„ ํ•ฉ๋‹ˆ๋‹ค.

  • ์ค„ ๋์˜ ๊ณต๋ฐฑ์„ ์ œ๊ฑฐ
  • ๋นˆ์ค„์„ ์ค„์ž„
  • ํŒŒ์ผ ๋์— ๋นˆ ์ค„์„ ์ถ”๊ฐ€

์ปค๋งจ๋“œ๋ฅผ ์‹คํ–‰ ํ•  ๋•Œ ํŒŒ์ผ์„ ๋ฐ˜๋“œ์‹œ ์ด๋Ÿฐ์‹์œผ๋กœ ๋„˜๊ฒจ์ค˜์•ผ ํ•ฉ๋‹ˆ๋‹ค.

$ git stripspace < README.md

Git stripspace ์ปค๋งจ๋“œ์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

SSH keys

์•„๋ž˜ ์ฃผ์†Œ๋ฅผ ๋ฐฉ๋ฌธํ•˜๋ฉด ๊ณต๊ฐœ ssh ํ‚ค์˜ ๋ชฉ๋ก์„ ์ผ๋ฐ˜ ํ…์ŠคํŠธ ํ˜•์‹์œผ๋กœ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

https://github.com/{user}.keys

์˜ˆ: https://github.com/tiimgreen.keys

๊ณต๊ฐœ ssh ํ‚ค ์ ‘๊ทผ์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Checking out Pull Requests

ํ’€ ๋ฆฌํ€˜์ŠคํŠธ๋Š” GitHub ์ €์žฅ์†Œ์—์„œ ์‚ฌ์šฉํ•˜๋Š” ํŠน๋ณ„ํ•œ ๋ธŒ๋žœ์น˜๋กœ ์—ฌ๋Ÿฌ ๋ฐฉ๋ฒ•์œผ๋กœ ๋กœ์ปฌ๋กœ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋น ๋ฅด๊ฒŒ diff๋‚˜ merge๋ฅผ ํ•˜๊ธฐ ์œ„ํ•ด ํŠน์ • ํ’€ ๋ฆฌํ€˜์ŠคํŠธ๋ฅผ ์ž„์‹œ๋กœ FETCH_HEAD๋กœ ๊ฐ€์ ธ์˜ค๋ ค๋ฉด ์ด๋ ‡๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค.

$ git fetch origin refs/pull/[PR-Number]/head

๋ชจ๋“  ํ’€ ๋ฆฌํ€˜์ŠคํŠธ ๋ธŒ๋žœ์น˜๋ฅผ refspec์— ์˜ํ•œ ๋กœ์ปฌ ๋ฆฌ๋ชจํŠธ ๋ธŒ๋žœ์น˜๋กœ ๋ฐ›์„ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

$ git fetch origin '+refs/pull/*/head:refs/remotes/origin/pr/*'

๋ฐ‘์˜ ์ค„๋“ค์„ ์ €์žฅ์†Œ์˜ .git/config์— ์ถ”๊ฐ€ํ•˜์—ฌ, ๋ฆฌ๋ชจํŠธ์˜ ํ’€ ๋ฆฌํ€˜์ŠคํŠธ๋ฅผ ์ž๋™์œผ๋กœ ๊ฐ€์ ธ์˜ค๊ฒŒ๋„ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = git@github.com:tiimgreen/github-cheat-sheet.git
[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = git@github.com:tiimgreen/github-cheat-sheet.git
    fetch = +refs/pull/*/head:refs/remotes/origin/pr/*

ํฌํฌ ๊ธฐ๋ฐ˜์˜ ํ’€ ๋ฆฌํ€˜์ŠคํŠธ ๊ธฐ์—ฌ๋ฅผ ์œ„ํ•ด, ํ’€ ๋ฆฌํ€˜์ŠคํŠธ์˜ ๋ฆฌ๋ชจํŠธ ๋ธŒ๋žœ์น˜๋ฅผ checkoutํ•ด ๋กœ์ปฌ ๋ธŒ๋žœ์น˜๋ฅผ ๋งŒ๋“œ๋Š” ๊ฒƒ์€ ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค.

$ git checkout pr/42 pr-42

์—ฌ๋Ÿฌ ์ €์žฅ์†Œ๋ฅผ ๋‹ค๋ฃจ์–ด์•ผ ํ•œ๋‹ค๋ฉด, ์ „์—ญ Git ์„ค์ •์—์„œ ํ’€ ๋ฆฌํ€˜์ŠคํŠธ๋ฅผ ๋ฐ›์„(fetching) ์ˆ˜ ์žˆ๋„๋ก ์„ค์ • ํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

git config --global --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pr/*"

์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ๋ชจ๋“  ์ €์žฅ์†Œ์—์„œ ์งง์€ ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

git fetch origin
git checkout pr/42

ํ’€ ๋ฆฌํ€˜์ŠคํŠธ๋ฅผ ๋กœ์ปฌ๋กœ ์ฒดํฌ์•„์›ƒ ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Empty Commits

--allow-empty๋ฅผ ์ถ”๊ฐ€ํ•˜์‹œ๋ฉด ์ฝ”๋“œ์˜ ๋ณ€๊ฒฝ ์—†์ด ์ปค๋ฐ‹์„ ๋„ฃ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

$ git commit -m "Big-ass commit" --allow-empty

์žˆ์„ ๋ฒ•ํ•œ ์‚ฌ์šฉ๋ฒ•์—๋Š” ์ด๋Ÿฐ ๊ฒƒ๋“ค์ด ์žˆ์Šต๋‹ˆ๋‹ค.

  • ํ•œ ๋ญ‰์น˜์˜ ์ผ์„ ์‹œ์ž‘ํ•˜๊ธฐ ์ „์— ์ฃผ์„์œผ๋กœ ์‚ฌ์šฉ
  • ์ฝ”๋“œ์™€ ๊ด€๋ จ์—†๋Š” ํ”„๋กœ์ ํŠธ ์ˆ˜์ •์„ ํ• ๋•Œ ์ฃผ์„์œผ๋กœ ์‚ฌ์šฉ
  • ์ €์žฅ์†Œ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ์‚ฌ๋žŒ๊ณผ์˜ ๋Œ€ํ™”
  • ์ €์žฅ์†Œ์˜ ์ฒซ ์ปค๋ฐ‹์œผ๋กœ ์‚ฌ์šฉ git commit -m "Initial commit" --allow-empty

Styled Git Status

$ git status

git status

-sb๋ฅผ ์ถ”๊ฐ€ํ•˜๋ฉด

$ git status -sb

์ด๋ ‡๊ฒŒ ๋ฐ”๋€๋‹ˆ๋‹ค.

git status -sb

Git status ์ปค๋งจ๋“œ์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Styled Git Log

์ด ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๋ฉด

$ git log --all --graph --pretty=format:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative

์ด๋ ‡๊ฒŒ ๋ณด์ž…๋‹ˆ๋‹ค.

git log --all --graph --pretty=format:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative

Palesz ๋‹˜ ๊ณ ๋ง™์Šต๋‹ˆ๋‹ค.

NOTE: ์ด ๋ช…๋ น์„ ์•Œ๋ฆฌ์•„์Šค(๋‹จ์ถ• ๋ช…๋ น)๋กœ ๋„ฃ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์˜ ์†Œ๊ฐœ๋ฅผ ๋ณด์„ธ์š”.

Git log ์ปค๋งจ๋“œ์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Git Query

Git ์ฟผ๋ฆฌ๋Š” ๋ชจ๋“  ์ด์ „ ์ปค๋ฐ‹ ๋ฉ”์‹œ์ง€์—์„œ ๊ฒ€์ƒ‰ํ•ด ๊ฐ€์žฅ ์ตœ๊ทผ์˜ ์ฟผ๋ฆฌ์— ๋งž๋Š” ์ปค๋ฐ‹์„ ์ฐพ์•„์ค๋‹ˆ๋‹ค.

$ git show :/query

query์—๋Š” ๊ฒ€์ƒ‰ํ•˜๊ณ  ์‹ถ์€ ๋ง์„ (๋Œ€์†Œ๋ฌธ์ž๋ฅผ ๊ตฌ๋ถ„ํ•ด) ๋„ฃ์œผ์„ธ์š”. ์ฃผ์–ด์ง„ ๊ฒ€์ƒ‰์–ด๊ฐ€ ์žˆ๋Š” ๊ฐ€์žฅ ๋งˆ์ง€๋ง‰ ์ปค๋ฐ‹์„ ํ‘œ์‹œํ•˜๊ณ  ๋ณ€๊ฒฝ๋œ ๋ผ์ธ์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.

$ git show :/typo

git show :/query

๋‚˜์˜ค๋ ค๋ฉด q๋ฅผ ๋ˆ„๋ฅด์„ธ์š”.

Git Grep

Git Grep์€ ํŒจํ„ด๊ณผ ์ผ์น˜ํ•˜๋Š” ์ค„์˜ ๋ชฉ๋ก์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•ด ๋ณด์„ธ์š”.

$ git grep aliases

aliases ๋ฌธ์ž์—ด์ด ํฌํ•จ๋œ ๋ชจ๋“  ํŒŒ์ผ์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.

git grep aliases

๋‚˜์˜ค๋ ค๋ฉด q๋ฅผ ๋ˆ„๋ฅด์„ธ์š”.

์—ฌ๋Ÿฌ ํ”Œ๋ž˜๊ทธ๋ฅผ ์ด์šฉํ•ด์„œ ์ข€ ๋” ๋ณต์žกํ•œ ๊ฒ€์ƒ‰์„ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค๋ฉด,

  • -e ๋‹ค์Œ ํŒŒ๋ผ๋ฏธํ„ฐ๋Š” ํŒจํ„ด (e.g. regex)
  • --and, --or, --not์œผ๋กœ ์—ฌ๋Ÿฌ ํŒจํ„ด์„ ์กฐํ•ฉ

์ด๋ ‡๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 $ git grep -e pattern --and -e anotherpattern

Git grep ์ปค๋งจ๋“œ์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Merged Branches

$ git branch --merged

์ด ๋ช…๋ น์–ด๋Š” ํ˜„์žฌ ๋ธŒ๋žœ์น˜์— ๋จธ์ง€๋œ ๋ชจ๋“  ๋ธŒ๋žœ์น˜์˜ ๋ชฉ๋ก์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.

๊ฑฐ๊พธ๋กœ

$ git branch --no-merged

์ด ๋ช…๋ น์–ด๋Š” ํ˜„์žฌ ๋ธŒ๋žœ์น˜์— ๋จธ์ง€๋˜์ง€ ์•Š์€ ๋ธŒ๋žœ์น˜์˜ ๋ชฉ๋ก์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.

Git branch ์ปค๋งจ๋“œ์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Fixup and Autosquash

์ด์ „(HEAD์˜ ํ•œ ๊ฐœ ์ด์ƒ ์ „์˜) ์ปค๋ฐ‹์— ์ž˜๋ชป๋œ ๋ถ€๋ถ„์ด ์žˆ๋‹ค๋ฉด, ์˜ˆ๋ฅผ ๋“ค์–ด abcde๋ผ๋ฉด, ๋ฌธ์ œ๋ฅผ ์ˆ˜์ •ํ•˜๊ณ  ๋ฐ‘์˜ ์ปค๋งจ๋“œ๋ฅผ ์ž…๋ ฅํ•ด ๊ณ ์น  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

$ git commit --fixup=abcde
$ git rebase abcde^ --autosquash -i

Git commit ์ปค๋งจ๋“œ์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”. Git rebase ์ปค๋งจ๋“œ์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Web Server for Browsing Local Repositories

Git instaweb ์ปค๋งจ๋“œ์„ ์‚ฌ์šฉํ•˜๋ฉด, ์ฆ‰์„์—์„œ gitweb ์•ˆ์—์„œ ์ž‘์—…์ค‘์ธ ์ €์žฅ์†Œ๋ฅผ ๋‘˜๋Ÿฌ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ์ปค๋งจ๋“œ๋Š” gitweb๊ณผ ๋กœ์ปฌ ์ €์žฅ์†Œ๋ฅผ ๋ธŒ๋ผ์šฐ์ง• ํ•˜๊ธฐ ์œ„ํ•œ ์›น ์„œ๋ฒ„๋ฅผ ์„ค์ •ํ•˜๋Š” ์Šคํฌ๋ฆฝํŠธ์ž…๋‹ˆ๋‹ค.

$ git instaweb

Opens:

Git instaweb

Git instaweb ์ปค๋งจ๋“œ์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Git Configurations

.gitconfig๋Š” ๋ชจ๋“  ์„ค์ •์ด ๋“ค์–ด์žˆ๋Š” ํŒŒ์ผ์ž…๋‹ˆ๋‹ค.

Aliases

์•Œ๋ฆฌ์•„์Šค๋Š” ์ปค์Šคํ…€ Git ๋ช…๋ น์–ด๋ฅผ ๋“ฑ๋กํ•  ์ˆ˜ ์žˆ๋Š” ํ—ฌํผ์ž…๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด git a๋กœ git add --all๋ฅผ ์‹คํ–‰ํ•˜๊ฒŒ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์•Œ๋ฆฌ์•„์Šค๋ฅผ ์ถ”๊ฐ€ํ•˜๋ ค๋ฉด ~/.gitconfig๋ฅผ ์ฐพ์•„ ๋‹ค์Œ ํฌ๋งท์œผ๋กœ ์ž…๋ ฅํ•˜๊ฑฐ๋‚˜

[alias]
  co = checkout
  cm = commit
  p = push
  # Show verbose output about tags, branches or remotes
  tags = tag -l
  branches = branch -a
  remotes = remote -v

์ปค๋งจ๋“œ ๋ผ์ธ์—์„œ ๋‹ค์Œ ๋ช…๋ น์„ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.

$ git config --global alias.new_alias git_function

์˜ˆ๋ฅผ ๋“ค๋ฉด

$ git config --global alias.cm commit

์—ฌ๋Ÿฌ ํ•จ์ˆ˜๋ฅผ ์•Œ๋ฆฌ์•„์Šคํ•˜๋ ค๋ฉด ๋”ฐ์˜ดํ‘œ๋ฅผ ์ด์šฉํ•˜์„ธ์š”.

$ git config --global alias.ac 'add -A . && commit'

์—ฌ๊ธฐ ๋ช‡ ๊ฐ€์ง€ ์œ ์šฉํ•œ ์•Œ๋ฆฌ์•„์Šค๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

Alias Current Command What to Type
git cm git commit git config --global alias.cm commit
git co git checkout git config --global alias.co checkout
git ac git add . -A git commit git config --global alias.ac '!git add -A && git commit'
git st git status -sb git config --global alias.st 'status -sb'
git tags git tag -l git config --global alias.tags 'tag -l'
git branches git branch -a git config --global alias.branches 'branch -a'
git cleanup git branch --merged | grep -v '*' | xargs git branch -d git config --global alias.cleanup "!git branch --merged | grep -v '*' | xargs git branch -d"
git remotes git remote -v git config --global alias.remotes 'remote -v'
git lg git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -- git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"

์ผ๋ถ€ ์•Œ๋ฆฌ์•„์Šค๋Š” @mathiasbynens ๋‹˜์˜ dotfiles์—์„œ ๊ฐ€์ ธ์™”์Šต๋‹ˆ๋‹ค.(https://github.com/mathiasbynens/dotfiles/blob/master/.gitconfig)

Auto-correct

ํ˜„์žฌ git comit๋ฅผ ์น˜๋ฉด ์ด๋Ÿฐ ๊ฒฐ๊ณผ๋ฅผ ๋ณด์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

$ git comit -m "Message"
# git: 'comit' is not a git command. See 'git --help'.

# Did you mean this?
#   commit

comit์„ ์ณค์„ ๋•Œ commit์„ ๋ถ€๋ฅด๋ ค๋ฉด, ์ž๋™ ๊ต์ •์„ ์ผœ๋‘์„ธ์š”.

$ git config --global help.autocorrect 1

์ด์ œ ์ด๋Ÿฐ ๊ฒฐ๊ณผ๋ฅผ ๋ณด์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

$ git comit -m "Message"
# WARNING: You called a Git command named 'comit', which does not exist.
# Continuing under the assumption that you meant 'commit'
# in 0.1 seconds automatically...

Color

Git ์ปค๋งจ๋“œ ๋ผ์ธ์— ์ƒ‰์„ ๋„ฃ์œผ๋ ค๋ฉด ์ด๋ ‡๊ฒŒ ํ•˜์„ธ์š”.

$ git config --global color.ui 1

Git config ์ปค๋งจ๋“œ์— ๋Œ€ํ•ด ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Git Resources

Title Link
Official Git Site http://git-scm.com/
Official Git Video Tutorials http://git-scm.com/videos
Code School Try Git http://try.github.com/
Introductory Reference & Tutorial for Git http://gitref.org/
Official Git Tutorial http://git-scm.com/docs/gittutorial
Everyday Git http://git-scm.com/docs/everyday
Git Immersion http://gitimmersion.com/
Git for Computer Scientists http://eagain.net/articles/git-for-computer-scientists/
Git Magic http://www-cs-students.stanford.edu/~blynn/gitmagic/
Git Visualization Playground http://onlywei.github.io/explain-git-with-d3/#freeplay
Learn Git Branching http://pcottle.github.io/learnGitBranching/
A collection of useful .gitignore templates https://github.com/github/gitignore

Git Books

Title Link
Pragmatic Version Control Using Git http://www.pragprog.com/titles/tsgit/pragmatic-version-control-using-git
Pro Git http://git-scm.com/book
Git Internals PluralSight https://github.com/pluralsight/git-internals-pdf
Git in the Trenches http://cbx33.github.com/gitt/
Version Control with Git http://www.amazon.com/Version-Control-Git-collaborative-development/dp/1449316387
Pragmatic Guide to Git http://www.pragprog.com/titles/pg_git/pragmatic-guide-to-git
Git: Version Control for Everyone http://www.packtpub.com/git-version-control-for-everyone/book

Git Videos

Title Link
Linus Torvalds on Git https://www.youtube.com/watch?v=4XpnKHJAok8
Introduction to Git with Scott Chacon https://www.youtube.com/watch?v=ZDR433b0HJY
Git From the Bits Up https://www.youtube.com/watch?v=MYP56QJpDr4
Graphs, Hashes, and Compression, Oh My! https://www.youtube.com/watch?v=ig5E8CcdM9g
GitHub Training & Guides https://www.youtube.com/watch?list=PLg7s6cbtAD15G8lNyoaYDuKZSKyJrgwB-&v=FyfwLX4HAxM

Git Articles

Title Link
GitHub Flow http://scottchacon.com/2011/08/31/github-flow.html