Skip to content

Latest commit

ย 

History

History
841 lines (558 loc) ยท 30.8 KB

README.ko.md

File metadata and controls

841 lines (558 loc) ยท 30.8 KB

๊นƒํ—ˆ๋ธŒ ์น˜ํŠธ ์‹œํŠธ

A collection of cool hidden and not so hidden features of Git and GitHub. This cheat sheet was inspired by Zach Holman's Git and GitHub Secrets talk at Aloha Ruby Conference 2012 (slides) and his More Git and GitHub Secrets talk at WDCNZ 2013 (slides).

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

๋ชฉ๋ก

GitHub

Ignore Whitespace

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

Diff without whitespace

๊นƒํ—ˆ๋ธŒ์˜ ๋น„๋ฐ€์„ ๋” ์ฝ์–ด ๋ณด์„ธ์š”.

Adjust Tab Space

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

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

Before, tab space example

๊ทธ๋ฆฌ๊ณ  ?ts=4๋ฅผ ๋ถ™์ธ ๋‹ค์Œ์—๋Š” ์ด๋ ‡๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. --allow-empty After, tab space example

Commit History by Author

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

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

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

Comparing Branches

๊นƒํ—ˆ๋ธŒ์—์„œ ๋ธŒ๋žœ์น˜ ๋น„๊ต๋ฅผ ํ•˜์‹œ๋ ค๋ฉด, 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-DD-MMํ˜•์‹์œผ๋กœ ์ ์Šต๋‹ˆ๋‹ค

Another compare example

์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ํŠน์ • ๋‚ ์งœ๋‚˜ ํ•œ ์‹œ๊ฐ„ ์ „์˜ ๋งˆ์Šคํ„ฐ ๋ธŒ๋žœ์น˜์˜ ์ฐจ์ด๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

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

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

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

Gist

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

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

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

Gists

gist๋ฅผ ๋งŒ๋“œ๋Š” ๋ฒ•์— ๋Œ€ํ•ด ๋” ์ฝ์–ด๋ณด์„ธ์š”.

Git.io

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

Git.io

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

$ 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๋ฅผ ๋ˆ„๋ฅด๋ฉด ์ปค๋งจ๋“œ ์ฐฝ์œผ๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.
  • 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

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

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

Cross-Link Issues

CI Status on Pull Requests

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

Travis CI status

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

Syntax Highlighting in Markdown Files

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

```ruby
require 'tabbit'
table = Tabbit.new('Name', 'Email')
table.add_row('Tim Green', '[email protected]')
puts table.to_s
```

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

require 'tabbit'
table = Tabbit.new('Name', 'Email')
table.add_row('Tim Green', '[email protected]')
puts table.to_s

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

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

Emojis

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

:smile:
:poop:
:shipit:
:+1:

๐Ÿ˜„ ๐Ÿ’ฉ :shipit: ๐Ÿ‘

๊นƒํ—ˆ๋ธŒ์—์„œ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์—๋ชจ์ง€์˜ ์ „ ๋ชฉ๋ก์€ emoji-cheat-sheet.com ๋‚˜ scotch-io/All-Github-Emoji-Icons์—์„œ ํ™•์ธํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

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

  1. :shipit: - :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)

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

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

Quick Licensing

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

License

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

License

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

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

Task Lists

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

- [ ] Be awesome
- [ ] Do stuff
- [ ] Sleep

Task List

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

- [x] Be awesome
- [x] Do stuff
- [ ] Sleep

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

Task Lists in Markdown Documents

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

- [ ] Mercury
- [x] Venus
- [x] Earth
- [x] Mars
- [ ] Jupiter
  • Mercury
  • Venus
  • Earth
  • Mars
  • Jupiter

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

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์„ ์ง€ํ‚ฌ ํฌ์ŠคํŠธ์™€ ํŽ˜์ด์ง€์—์„œ ์‚ฌ์šฉํ•˜๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค.

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

Viewing YAML Metadata in your Documents

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

YAML metadata

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

Rendering Tabular Data

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

Tabular data

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

Diffs

Rendered Prose Diffs

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

Source / Rendered view

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

Rendered Prose Diffs

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

Diffable Maps

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

Diffable Maps

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

Expanding Context in Diffs

diff์˜ ๋‹ซ์•„๋‘” ๊ณณ์˜ ํŽผ์นจ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด, ๋ฌธ๋งฅ์„ ๋” ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ „์ฑ„ ํŒŒ์ผ์„ ํ‘œ์‹œํ• ๋•Œ๊นŒ์ง€ ๊ณ„์† ํŽผ์น  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ๊นƒํ—ˆ๋ธŒ์—์„œ 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

(...)

Hub - Git Wrapper

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

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

$ hub clone tiimgreen/toc

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

Decreasing Contributor Friction

์‚ฌ๋žŒ๋“ค์ด ์‚ฌ์šฉํ•˜๊ณ  ๊ธฐ์—ฌํ•  ์ˆ˜ ์žˆ๋Š” ํ”„๋กœ์ ํŠธ๋ฅผ ๋งŒ๋“œ๋ ค๋ฉด, ๊ฐ€์žฅ ๊ธฐ๋ณธ์ ์ธ ์งˆ๋ฌธ์— ๋Œ€๋‹ตํ•  ์ˆ˜ ์žˆ์–ด์•ผํ•ฉ๋‹ˆ๋‹ค. ์ด ํ”„๋กœ์ ํŠธ๋Š” ๋ฌด์—‡์ž…๋‹ˆ๊นŒ? ์–ด๋–ป๊ฒŒ ์‚ฌ์šฉํ•ฉ๋‹ˆ๊นŒ? ์–ด๋””๊นŒ์ง€ ํ—ˆ์šฉ๋ฉ๋‹ˆ๊นŒ? ์–ด๋–ป๊ฒŒ ๊ธฐ์—ฌํ•ฉ๋‹ˆ๊นŒ? ์–ด๋–ป๊ฒŒ ๊ฐœ๋ฐœํ•˜๊ณ  ์‹คํ–‰ํ•ด์•ผ ํ•ฉ๋‹ˆ๊นŒ? ์–ด๋–ป๊ฒŒ ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ์ด ์ด์ „ ๊ธฐ๋Šฅ์„ ์†์ƒ๋˜์ง€ ์•Š์•˜๋Š”์ง€ ํ™•์ธํ•ด์•ผ ํ•ฉ๋‹ˆ๊นŒ?

Friction์€ ์ด๋Ÿฌํ•œ ์ผ๋ฐ˜์ ์ธ ์งˆ๋ฌธ๋“ค์˜ ๋‹ต์ด ํ”„๋กœ์ ํŠธ ์•ˆ์— ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ์ปค๋งจ๋“œ ๋ผ์ธ ์Šคํฌ๋ฆฝํŠธ ์ž…๋‹ˆ๋‹ค. ๋‹ค์Œ์€ ์ƒ˜ํ”Œ ์ถœ๋ ฅ ์ž…๋‹ˆ๋‹ค.

Friction output

Friction ์€ MRI 2.1.0, MRI 2.0.0, MRI 1.9.3์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.

Contributing Guidelines

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

Contributing Guidelines

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

GitHub Resources

Title Link
GitHub Explore https://github.com/explore
GitHub Blog https://github.com/blog
GitHub Help https://help.github.com/
GitHub Training http://training.github.com/
GitHub Developer https://developer.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

Previous Branch

์ปค๋งจ๋“œ ๋ผ์ธ์—์„œ ์ด์ „ ๋””๋ ‰ํ„ฐ๋ฆฌ๋กœ ์ด๋™ํ•˜๋ ค๋ฉด ์ด๋ ‡๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค.

$ cd -

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

$ git checkout -
# Switched to branch 'master'

$ git checkout -
# Switched to branch 'next'

$ git checkout -
# Switched to branch 'master'

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

Stripspace

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

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

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

$ git stripspace < README.md

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

Checking out Pull Requests

ํ’€ ๋ฆฌํ€˜์ŠคํŠธ๋ฅผ ์ฒดํฌ์•„์›ƒํ•˜๋ ค๋ฉด, ๋‹ค์Œ ๋ช…๋ น์–ด๋กœ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

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

๊ทธ๋ฆฌ๊ณ  ๋‹ค์Œ ๋ช…๋ น์„ ์‚ฌ์šฉํ•ด ํ’€ ๋ฆฌํ€˜์ŠคํŠธ(์˜ˆ๋ฅผ ๋“ค์–ด 42๋ผ๋ฉด)๋ฅผ ์ฒดํฌ์•„์›ƒํ•ฉ๋‹ˆ๋‹ค.

$ git checkout refs/pull/42

์•„๋‹ˆ๋ฉด, ๋ฆฌ๋ชจํŠธ ๋ธŒ๋žœ์น˜์—์„œ ๊ฐ€์ ธ์˜ฌ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

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

๊ทธ๋ฆฌ๊ณ  ์ฒดํฌ์•„์›ƒ์€ ์ด๋ ‡๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค.

$ git checkout origin/pr/42

๊ทธ๋ฆฌ๊ณ  ๋ฐ‘์˜ ์ค„์„ .git/config์— ์ถ”๊ฐ€ํ•˜๋ฉด, ์ž๋™์œผ๋กœ ๊ฐ€์ ธ์˜ค๊ฒŒ๋„ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

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

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

Empty Commits :trollface:

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

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

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

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

Styled Git Status

$ git status

git status

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

$ git status -sb

git status -sb

๊นƒ 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: ์ด ๋ช…๋ น์„ ์•Œ๋ฆฌ์•„์Šค (๋‹จ์ถ• ๋ช…๋ น)์œผ๋กœ ๋„ฃ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์˜ ์†Œ๊ฐœ๋ฅผ ๋ณด์„ธ์š”.

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

Git Query

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

$ git show :/query

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

$ git show :/typo

git show :/query

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

Merged Branches

$ git branch --merged

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

๊ฑฐ๊พธ๋กœ

$ git branch --no-merged

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

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

Web Server for Browsing Local Repositories

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

$ git instaweb

Opens:

Git instaweb

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

Git Configurations

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

Aliases

์•Œ๋ฆฌ์•„์Šค๋Š” ์ปค์Šคํ…€ ๊นƒ ๋ช…๋ น์–ด๋ฅผ ๋“ฑ๋กํ•  ์ˆ˜ ์žˆ๋Š” ํ•ผํผ์ž…๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด 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

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

$ 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 remotes git remote -v git config --global alias.remotes 'remote -v'

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 config --global color.ui 1

๊นƒ 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/
Ry's Git Tutorial http://rypress.com/tutorials/git/index.html
Git for Designer http://hoth.entp.com/output/git_for_designers.html
Git for Computer Scientists http://eagain.net/articles/git-for-computer-scientists/
Git Magic http://www-cs-students.stanford.edu/~blynn/gitmagic/
GitHub Training Kit http://training.github.com/kit

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 Peepcode http://peepcode.com/products/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