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
- Adjust Tab Space
- Commit History by Author
- Cloning a Repository
- Comparing Branches
- Compare Branches across Forked Repositories
- Gists
- Git.io
- Keyboard Shortcuts
- Line Highlighting in Repositories
- Closing Issues via Commit Messages
- Cross-Link Issues
- CI Status on Pull Requests
- Syntax Highlighting in Markdown Files
- Emojis
- Images/GIFs
- Quick Quoting
- Quick Licensing
- Task Lists
- Relative Links
- Metadata and Plugin Support for GitHub Pages
- Viewing YAML Metadata in your Documents
- Rendering Tabular Data
- Diffs
- Hub
- Decreasing Contributor Friction
- Contributing Guidelines
- GitHub Resources
- Git
- Previous Branch
- Stripspace
- Checking out Pull Requests
- Empty Commits
- Styled Git Status
- Styled Git Log
- Git Query
- Merged Branches
- Web Server for Browsing Local Repositories
- Git Configurations
- Git Resources
?w=1
๋ฅผ diff URL์ ์ถ๊ฐํ๋ฉด ๋ณ๊ฒฝ๋ ์ฝ๋๋ง ๋ณผ ์ ์๋๋ก, ๊ณต๋ฐฑ๋ง ๋ฐ๋ ์์ ์ ์ ๊ฑฐํ ์ ์์ต๋๋ค.
๊นํ๋ธ์ ๋น๋ฐ์ ๋ ์ฝ์ด ๋ณด์ธ์.
diff๋ ํ์ผ URL์ ?ts=4
๋ฅผ ๋ง๋ถ์ด๋ฉด ํ
๋ฌธ์์ ํฌ๊ธฐ๋ฅผ ๊ธฐ๋ณธ๊ฐ์ธ 8๋์ 4๊ณต๋ฐฑ์ผ๋ก ๋ณด์ฌ์ค๋๋ค. ts
๋ค์ ์ซ์๋ ์ค์ ์ ๋ง๊ฒ ๋ณ๊ฒฝ ํ์ค ์ ์์ต๋๋ค. gist๋ rawํ์ผ์๋ ์ ์ฉ ๋์ง ์์ต๋๋ค.
์ฌ๊ธฐ์ ์๋ Go ์์ค ํ์ผ์ ?ts=4
๋ฅผ ๋ถ์ด๊ธฐ ์ ์๋ ์ด๋ ์ต๋๋ค.
๊ทธ๋ฆฌ๊ณ ?ts=4
๋ฅผ ๋ถ์ธ ๋ค์์๋ ์ด๋ ๊ฒ ๋ฉ๋๋ค.
--allow-empty
ํน์ ์ปค๋ฏธํฐ๊ฐ ํ ๋ชจ๋ ์ปค๋ฐ์ ๋ณด๊ณ ์ถ๋ค๋ฉด URL์ ?author=username
๋ฅผ ์ถ๊ฐํ์ธ์.
https://github.com/rails/rails/commits/master?author=dhh
์ปค๋ฐ ๋ทฐ๊ฐ์ ์ฐจ์ด์ ๋ํด ๋ ์ฝ์ด๋ณด์ธ์.
์ ์ฅ์๋ฅผ ํด๋ก ํ ๋, ๋งจ ๋ค์ .git
์ ์๋ตํ ์ ์์ต๋๋ค.
$ git clone https://github.com/tiimgreen/github-cheat-sheet
๊น clone
์ปค๋งจ๋์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
๊นํ๋ธ์์ ๋ธ๋์น ๋น๊ต๋ฅผ ํ์๋ ค๋ฉด, URL์ ์ด๋ฐ ์์ผ๋ก ๋ฐ๊พธ์ธ์.
https://github.com/user/repo/compare/{range}
{range}
๋ master...4-1-stable
์์ผ๋ก ์ ์ต๋๋ค.
์๋ฅผ ๋ค์ด
https://github.com/rails/rails/compare/master...4-1-stable
{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
ํ์์ผ๋ก ์ ์ต๋๋ค
์ด๋ ๊ฒ ํ๋ฉด ํน์ ๋ ์ง๋ ํ ์๊ฐ ์ ์ ๋ง์คํฐ ๋ธ๋์น์ ์ฐจ์ด๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.
์๊ฐ์ผ๋ก ์ปค๋ฐ์ ๋น๊ตํ๋ ๋ฒ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
ํฌํฌ๋ ์ ์ฅ์๊ฐ์ ๋ธ๋์น๋ฅผ ๋น๊ตํ๋ ค๋ฉด URL์ ์ด๋ ๊ฒ ๋ณ๊ฒฝํ์ธ์.
https://github.com/user/repo/compare/{foreign-user}:{branch}...{own-branch}
์๋ฅผ ๋ค๋ฉด
https://github.com/rails/rails/compare/byroot:idempotent-counter-caches...master
Gists๋ ๋ณธ๊ฒฉ์ ์ธ ์ ์ฅ์๋ฅผ ๋ง๋ค์ง ์๊ณ , ์์ ์ฝ๋ ์กฐ๊ฐ๊ณผ ์ผํ ์ ์๋ ์ฌ์ด ๋ฐฉ๋ฒ์ ๋๋ค.
์ด๋ ๊ฒ Gist URL๋ค์ .pibb
๋ฅผ ๋ฃ์ผ๋ฉด ๋ค๋ฅธ ์ฌ์ดํธ์ ๋ฃ์์ ์๋ HTML ์จ๋ฆฌ ๋ฒ์ ์ ๋ง๋ค ์ ์์ต๋๋ค.
Gists๋ ๋ณธ๊ฒฉ์ ์ธ ์ ์ฅ์์ฒ๋ผ ์ทจ๊ธํ ์ ์๊ณ ํด๋ก ๋ ๋ฉ๋๋ค.
$ git clone https://gist.github.com/tiimgreen/10545817
gist๋ฅผ ๋ง๋๋ ๋ฒ์ ๋ํด ๋ ์ฝ์ด๋ณด์ธ์.
Git.io๋ ๊นํ๋ธ๋ฅผ ์ํ ๊ฐ๋จํ URL ๋จ์ถ๊ธฐ์ ๋๋ค.
์์ 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์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
์ ์ฅ์ ํ์ด์ง์์ ๋จ์ถํค๋ฅผ ์ฌ์ฉํ๋ฉด ์ฝ๊ฒ ์ด๋ํ ์ ์์ต๋๋ค.
t
๋ฅผ ๋๋ฅด๋ฉด ํ์ผ ํ์ ํ์ด์ง๋ก ์ด๋ํฉ๋๋ค.w
๋ฅผ ๋๋ฅด๋ฉด ๋ธ๋ ์น ์ ํ ํ์ด์ง๋ก ์ด๋ํฉ๋๋ค.s
๋ฅผ ๋๋ฅด๋ฉด ์ปค๋งจ๋ ์ฐฝ์ผ๋ก ์ด๋ํฉ๋๋ค.l
๋ฅผ ๋๋ฅด๋ฉด ์๋ ์ด์์ ๋ผ๋ฒจ์ ์์ ํ ์ ์์ต๋๋ค.- ํ์ผ์ ๋ณด๊ณ ์์ ๋ (์๋ฅผ ๋ค์ด
https://github.com/tiimgreen/github-cheat-sheet/blob/master/README.md
)y
๋ฅผ ๋๋ฅด๋ฉด URL์ ์ง๊ธ ๋ณด๊ณ ์๋ ํ์ด์ง๋ฅผ ์ฌ์ค์ ๊ณ ์ ํ๋๋ก ํฉ๋๋ค. ์ฝ๋๊ฐ ๋ฐ๋๋ค๊ณ ํด๋ ์ด๋ฒ์ ๋ณธ ๋ด์ฉ์ ๋ค์ ๋ณผ ์ ์์ต๋๋ค.
์ง๊ธ ํ์ด์ง์์ ์ธ ์ ์๋ ๋ชจ๋ ๋จ์ถํค๋ฅผ ๋ณด์๋ ค๋ฉด ?
๋ฅผ ๋๋ฅด์ธ์.
์ปค๋งจ๋ ๋ฐ์ ์ฌ์ฉ๋ฒ์ ๋ ์ฝ์ด ๋ณด์ธ์.
์ฝ๋ ํ์ผ URL์ ๋์ #L52
๋ฅผ ์ถ๊ฐํ๊ฑฐ๋ ์ค ๋ฒํธ๋ฅผ ํด๋ฆญํ๋ฉด ๊ทธ ์ค ๋ฒํธ๋ฅผ ํ์ด๋ผ์ดํธํฉ๋๋ค.
#L53-L60
์ฒ๋ผ ๋ฒ์์ง์ ๋ ๊ฐ๋ฅํฉ๋๋ค. ๋ฒ์๋ฅผ ์ง์ ํ๋ ค๋ฉด shift
ํค๋ฅผ ๋๋ฅธ ์ฑ ๋ ๋ผ์ธ์ ํด๋ฆญํ๋ฉด ๋ฉ๋๋ค.
https://github.com/rails/rails/blob/master/activemodel/lib/active_model.rb#L53-L60
์ด๋ค ์ปค๋ฐ์ด ์ด์๋ฅผ ๊ณ ์ณค๋ค๋ฉด, fix/fixes/fixed
, close/closes/closed
, resolve/resolves/resolved
๋ฅผ ํค์๋๋ก ํด๋น ์ด์๊ฐ ๋ง์คํฐ ๋ธ๋์น์ ์ปค๋ฐ ๋ ๋ ๋ซ์ ์ ์์ต๋๋ค.
$ git commit -m "Fix screwup, fixes #12"
์ด๋ ๊ฒ ํ๋ฉด ์ด์๋ฅผ ๋ซ๊ณ ํด๋ก์ง ์ปค๋งจํธ๋ก ์ฐธ์กฐํ๊ฒ ํฉ๋๋ค.
์ปค๋ฐ ๋ฉ์ธ์ง๋ก ์ด์ ๋ซ๊ธฐ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
๊ฐ์ ์ ์ฅ์์ ๋ค๋ฅธ ์ด์๋ฅผ ๋งํฌํ๊ธฐ ์ํ๋ค๋ฉด, #
๋ค์ ์ด์ ๋ฒํธ๋ง ์
๋ ฅํ์๋ฉด ์๋์ผ๋ก ๋งํฌ๋ฉ๋๋ค.
๋ค๋ฅธ ์ ์ฅ์์ ์ด์๋ฅผ ๋งํฌํ๊ณ ์ถ๋ค๋ฉด ์ฌ๋_์ด๋ฆ/์ ์ฅ์_์ด๋ฆ#์ด์_๋ฒํธ
๋ก ํ ์ ์์ต๋๋ค. (์ tiimgreen/toc#12
)
์ ํํ ์ค์ ๋์๋ค๋ฉด, ํ ๋ฆฌํ์คํธ๋ฅผ ๋ฐ๊ฑฐ๋ ํ ๋ฆฌํ์คํธ์ ์๋ก์ด ์ปค๋ฐ์ ํ ๋ ๋ง๋ค, Travis CI๊ฐ ํ ๋ฆฌํ์คํธ๋ฅผ ๋น๋ ํ ๊ฒ์ ๋๋ค. Travis CI ์์ํ๊ธฐ๋ฅผ ์ข ๋ ์ฝ์ด๋ณด์ธ์.
์ปค๋ฐ ์ํ API์ ๋ํด ์ข ๋ ์ฝ์ด๋ณด์ธ์.
๋งํฌ๋ค์ด์์ ์๋ฅผ ๋ค์ด, ๋ฃจ๋น ์ฝ๋๋ฅผ ์ ํ ์ค ํ์ด๋ผ์ดํธ ํ๋ ค๋ฉด ์ด๋ ๊ฒ ํฉ๋๋ค.
```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 ๋งํฌ๋ค์ด์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
์๋ชจ์ง๋ ํ ๋ฆฌํ์คํธ, ์ด์, ์ปค๋ฐ ๋ฉ์ธ์ง, README๋ฑ๋ฑ์์ :์๋ชจ์ง์_์ด๋ฆ:
์ผ๋ก ๋ง๋ค ์ ์์ต๋๋ค.
:smile:
:poop:
:shipit:
:+1:
๐
๐ฉ
๐
๊นํ๋ธ์์ ์ฌ์ฉ ๊ฐ๋ฅํ ์๋ชจ์ง์ ์ ๋ชฉ๋ก์ emoji-cheat-sheet.com ๋ scotch-io/All-Github-Emoji-Icons์์ ํ์ธํ์ค ์ ์์ต๋๋ค.
๊นํ๋ธ์์ ๋ง์ด ์ฌ์ฉํ๋ ์๋ชจ์ง ํ 5์๋ ์ด๋ ์ต๋๋ค.
-
:shipit:
- โจ -
:sparkles:
- ๐ -
:-1:
- ๐ -
:+1:
- ๐ -
:clap:
์ปค๋งจํธ๋ README๋ฑ๋ฑ์ ์ด๋ฏธ์ง์ GIF๋ฅผ ๋ฃ์ ์ ์์ต๋๋ค.

๋ชจ๋ ์ด๋ฏธ์ง๋ GitHub์์ ์ผ์ฌํฉ๋๋ค. ๊ทธ๋์ ํธ์คํธ๊ฐ ์ฃฝ์ด๋ ์ด๋ฏธ์ง๋ ์ฌ์ ํ ๋จ์ต๋๋ค.
์ด๋ฏธ์ง๋ฅผ ์ํค ํ์ด์งใ ๋ฃ๋ ๋ฐฉ๋ฒ์ ์ฌ๋ฟ ์์ต๋๋ค. ์์ ๋ณด์ด๋ ์ผ๋ฐ ๋งํฌ๋ค์ด ๋ฌธ๋ฒ๋ ์์ง๋ง, ์ด๋ฏธ์ง์ ๋์ด์ ๋์ด๋ฅผ ์ง์ ํ ์ ์๋ ๋ฌธ๋ฒ๋ ์์ต๋๋ค.
[[ http://www.sheawong.com/wp-content/uploads/2013/08/keephatin.gif | height = 100px ]]
์ด๋ ๊ฒ ๋ณด์ ๋๋ค.
์ค๋ ๋์ ๋ต๊ธ๋ค ๋ ์ ์ ๋๊ฐ ๋งํ ์ด๋ค ๋ด์ฉ์ ์ธ์ฉํ๊ณ ์ถ๋ค๋ฉด, ํ
์คํธ๋ฅผ ํ์ด๋ผ์ดํธํ๊ณ r
์ ๋๋ฅด์ธ์. ์ด๋ ๊ฒ ํ๋ฉด ๋ด์ฉ์ ํ
์คํธ ๋ฐ์ค์ ์ธ์ฉ ํฌ๋งท์ผ๋ก ๋ณต์ฌํด ์ค๋๋ค.
๋น ๋ฅธ ์ธ์ฉ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
์ ์ฅ์๋ฅผ ๋ง๋ค ๋, ๊นํ๋ธ๋ ๋ง๋ค์ด์ง ์ ์๊ถ์ ์ถ๊ฐํ ์ ์๋ ์ต์ ์ ์ ๊ณตํฉ๋๋ค.
์ด๋ฏธ ์๋ ์ ์ฅ์์๋ ์น ์ธํฐํ์ด์ค์์ ์ ํ์ผ์ ๋ง๋ค์ด ์ถ๊ฐํ ์ ์์ต๋๋ค.
์ด๋ฆ์ LICENSE
๋ฅผ ์
๋ ฅํ๋ฉด ์ต์
์ผ๋ก ํ
ํ๋ฆฟ์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
.gitignore
์๋ ๋๊ฐ์ด ์ ์ฉ๋ฉ๋๋ค.
์คํ ์์ค ์ ์๊ถ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
์ด์์ ํ ๋ฆฌํ์คํธ์์ ๋ฐ์ ๋ฌธ๋ฒ์ผ๋ก ์ฒดํฌ๋ฐ์ค๋ฅผ ๋ฃ์ ์ ์์ต๋๋ค.(์คํ์ด์ค์ ์ฃผ์ํ์ธ์.)
- [ ] Be awesome
- [ ] Do stuff
- [ ] Sleep
์ฒดํฌ๋ฐ์ค๊ฐ ํด๋ฆญ ๋๋ฉด, ์์ ๋งํฌ๋ค์ด์์ ๊ฐฑ์ ์ด ์ด๋ฃจ์ด์ง๋๋ค.
- [x] Be awesome
- [x] Do stuff
- [ ] Sleep
ํ ์คํฌ ๋ฆฌ์คํธ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
์ด์ ๋งํฌ๋ค์ด ๋ฌธ์์์ ์ฝ๊ธฐ ์ ์ฉ ์ฒดํฌ๋ฆฌ์คํธ๋ฅผ ๋ฃ์ ์ ์์ต๋๋ค.
- [ ] Mercury
- [x] Venus
- [x] Earth
- [x] Mars
- [ ] Jupiter
- Mercury
- Venus
- Earth
- Mars
- Jupiter
๋งํฌ๋ค์ด ๋ฌธ์์์์ ํ ์คํฌ ๋ฆฌ์คํธ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
์๋ ๊ฒฝ๋ก ๋งํฌ๋ ๋งํฌ๋ค์ด ํ์ผ์ด ๋ด๋ถ ๊ฑดํ ์ธ ๋ก ๋งํฌ๋ ๋ ์ถ์ฒํฉ๋๋ค.
[Link to a header](#awesome-section)
[Link to a file](docs/readme)
์ ๋ ๊ฒฝ๋ก ๋งํฌ๋ URL์ด ๋ณ๊ฒฝ ๋ ๋ ๋ง๋ค ๋ณ๊ฒฝํด์ผ ํฉ๋๋ค. (์๋ฅผ ๋ค์ด ์ ์ฅ์ ์ด๋ฆ ๋ณ๊ฒฝ, ์ ์ ์ด๋ฆ ๋ณ๊ฒฝ, ํ๋ก์ ํธ ํฌํฌ) ์๋ ๊ฒฝ๋ก ๋งํฌ๋ฅผ ์ฌ์ฉํ๋ฉด ๋ฌธ์๋ฅผ ์ฝ๊ฒ ์ค์ค๋ก ๋ ๋ฆฝ์ ์ผ๋ก ๋ง๋ค ์ ์์ต๋๋ค.
์๋ ๊ฒฝ๋ก ๋งํฌ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
์งํฌ๋ก ์์ฑ๋ ํ์ด์ง์ ํฌ์คํธ์์, ์ ์ฅ์ ์ ๋ณด๋ ์๋ฅผ ๋ค์ด {{ site.github.project_title }}
์ฒ๋ผ site.github
์ด๋ฆ ๊ณต๊ฐ์ผ๋ก ์ฌ์ฉํ๊ณ ํ์ํ ์ ์์ต๋๋ค.
Jemoji์ jekyll-mentionsํ๋ฌ๊ทธ์ธ์ GitHub.com์์ ์ฒ๋ผ emoji์ @mentions์ ์งํฌ ํฌ์คํธ์ ํ์ด์ง์์ ์ฌ์ฉํ๊ฒ ํฉ๋๋ค.
Jekyll์ด๋ GitHub Pages๊ฐ์ ๋ง์ ๋ธ๋ก๊ทธ์์ ํฌ์คํธ์ ์ฒ์์ YAML ํฌ๋ฉง์ ๋ฉํ๋ฐ์ดํฐ๋ฅผ ํ์๋ก ํฉ๋๋ค. ๊นํ๋ธ๋ ์ด ๋ฉํ ์ ๋ณด๋ฅผ ์ฝ๊ธฐ ํธํ๊ฒ ํ ์ด๋ธ๋ก ํ์ํด ์ค๋๋ค.
๋ฌธ์์์ YAML ๋ฉํ๋ฐ์ดํฐ ๋ณด๊ธฐ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
๊นํ๋ธ๋ .csv
(comma-separated) ์ .tsv
(tab-separated)ํ์ผ์ ๋ํด ํ(tabular) ๋ฐ์ดํฐ ๋ณด๊ธฐ๋ฅผ ์ง์ํฉ๋๋ค.
ํ ๋ฐ์ดํ ํ์์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
์ฐ๋ฌธ(prose) ํ์ผ์ด ์๋ ์ปค๋ฐ๊ณผ ํ ๋ฆฌํ์คํธ๋ source์ rendered ๋ทฐ ๊ธฐ๋ฅ์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
"rendered" ๋ฒํผ์ ํด๋ฆญํ์๋ฉด ๋ ๋๋ ๋ฌธ์์์ ๋ณ๊ฒฝ์ ํ์ธํ์ค ์ ์์ต๋๋ค. ๋ ๋๋ ์ฐ๋ฌธ(prose) ๋ทฐ๋ ๋ฌธ์ฅ์ ์ถ๊ฐ, ์ญ์ , ๋ณ๊ฒฝํ์๋ ์ ์ฉํฉ๋๋ค.
๋ ๋๋ ์ฐ๋ฌธ(prose) diff์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
์ง์ค๋ฐ์ดํ๊ฐ ํฌํจ๋ ์ปค๋ฐ์ด๋ ํ ๋ฆฌํ์คํธ๋ฅผ ๋ณผ ๋๋ง๋ค ๊นํ๋ธ๋ ๋ฌด์์ด ๋ณ๊ฒฝ ๋์๋์ง ์๊ฐ์ ์ผ๋ก ๋ณด์ฌ์ค๋๋ค.
diff ๊ฐ๋ฅํ ๋งต์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
diff์ ๋ซ์๋ ๊ณณ์ ํผ์นจ ๋ฒํผ์ ํด๋ฆญํ๋ฉด, ๋ฌธ๋งฅ์ ๋ ๋ณผ ์ ์์ต๋๋ค. ์ ์ฑ ํ์ผ์ ํ์ํ ๋๊น์ง ๊ณ์ ํผ์น ์ ์์ผ๋ฉฐ, ๊นํ๋ธ์์ diff๊ฐ ํ์๋๋ ์ฅ์๋ผ๋ฉด ์ด๋์๋ ์ฌ์ฉ๊ฐ๋ฅํฉ๋๋ค.
diff์์์ ๋ฌธ๋งฅ ํ์ฅ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
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๋ ๊นํ๋ธ๋ฅผ ์ข ๋ ์ฝ๊ฒ ์ฌ์ฉํ ์ ์๋๋ก ์ถ๊ฐ ๊ธฐ๋ฅ ๋ฐ ๋ช ๋ น์ ์ ๊ณตํ๋ ์ปค๋งจ๋ ๋ผ์ธ ๊น ๋ํผ์ ๋๋ค.
์ด๋ ๊ฒ ํ ์ ์์ต๋๋ค.
$ hub clone tiimgreen/toc
Hub๊ฐ ์ ๊ณตํ๋ ๋ ๋ฉ์ง ๊ธฐ๋ฅ๋ค์ ํ์ธํด ๋ณด์ธ์.
์ฌ๋๋ค์ด ์ฌ์ฉํ๊ณ ๊ธฐ์ฌํ ์ ์๋ ํ๋ก์ ํธ๋ฅผ ๋ง๋๋ ค๋ฉด, ๊ฐ์ฅ ๊ธฐ๋ณธ์ ์ธ ์ง๋ฌธ์ ๋๋ตํ ์ ์์ด์ผํฉ๋๋ค. ์ด ํ๋ก์ ํธ๋ ๋ฌด์์ ๋๊น? ์ด๋ป๊ฒ ์ฌ์ฉํฉ๋๊น? ์ด๋๊น์ง ํ์ฉ๋ฉ๋๊น? ์ด๋ป๊ฒ ๊ธฐ์ฌํฉ๋๊น? ์ด๋ป๊ฒ ๊ฐ๋ฐํ๊ณ ์คํํด์ผ ํฉ๋๊น? ์ด๋ป๊ฒ ์๋ก์ด ๊ธฐ๋ฅ์ด ์ด์ ๊ธฐ๋ฅ์ ์์๋์ง ์์๋์ง ํ์ธํด์ผ ํฉ๋๊น?
Friction์ ์ด๋ฌํ ์ผ๋ฐ์ ์ธ ์ง๋ฌธ๋ค์ ๋ต์ด ํ๋ก์ ํธ ์์ ์๋์ง ํ์ธํ๋ ์ปค๋งจ๋ ๋ผ์ธ ์คํฌ๋ฆฝํธ ์ ๋๋ค. ๋ค์์ ์ํ ์ถ๋ ฅ ์ ๋๋ค.
Friction ์ MRI 2.1.0, MRI 2.0.0, MRI 1.9.3์ ์ง์ํฉ๋๋ค.
์ ์ฅ์์ ์ ์ผ ์์ CONTRIBUTING
ํ์ผ์ ๋ฃ์ด๋๋ฉด ๊ธฐ์ฌ์๊ฐ ์ด์๋ฅผ ๋ง๋ค๊ฑฐ๋ ํ ๋ฆฌํ์คํธ๋ฅผ ๋ง๋ค ๋ ๋งํฌ๋ก ๋ณด์ฌ์ค๋๋ค.
๊ธฐ์ฌํ๊ธฐ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
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/ |
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 |
์ปค๋งจ๋ ๋ผ์ธ์์ ์ด์ ๋๋ ํฐ๋ฆฌ๋ก ์ด๋ํ๋ ค๋ฉด ์ด๋ ๊ฒ ํฉ๋๋ค.
$ cd -
๋น์ทํ๊ฒ, ๊น์์ ๋ง์ง๋ง ๋ธ๋์น๋ก ๋์๊ฐ๋ ๊ฑด ์ด๋ ๊ฒ ํ ์ ์์ต๋๋ค.
$ git checkout -
# Switched to branch 'master'
$ git checkout -
# Switched to branch 'next'
$ git checkout -
# Switched to branch 'master'
๊น ๋ธ๋์น์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
๊น Stripspace๋ ์ด๋ฐ ์ผ์ ํฉ๋๋ค.
- ์ค ๋์ ๊ณต๋ฐฑ์ ์ ๊ฑฐ
- ๋น์ค์ ์ค์
- ํ์ผ ๋์ ๋น ์ค์ ์ถ๊ฐ
์ปค๋งจ๋๋ฅผ ์คํ ํ ๋ ํ์ผ์ ๋ฐ๋์ ์ด๋ฐ์์ผ๋ก ๋๊ฒจ์ค์ผ ํฉ๋๋ค.
$ git stripspace < README.md
๊น stripspace
์ปค๋งจ๋์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
ํ ๋ฆฌํ์คํธ๋ฅผ ์ฒดํฌ์์ํ๋ ค๋ฉด, ๋ค์ ๋ช ๋ น์ด๋ก ๊ฐ์ ธ์ฌ ์ ์์ต๋๋ค.
$ 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/*
ํ ๋ฆฌํ์คํธ๋ฅผ ๋ก์ปฌ๋ก ์ฒดํฌ์์ ํ๋ ๋ฐฉ๋ฒ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
--allow-empty
๋ฅผ ์ถ๊ฐํ์๋ฉด ์ฝ๋์ ๋ณ๊ฒฝ ์์ด ์ปค๋ฐ์ ๋ฃ์ ์ ์์ต๋๋ค.
$ git commit -m "Big-ass commit" --allow-empty
์์ ๋ฒํ ์ฌ์ฉ๋ฒ์๋ ์ด๋ฐ ๊ฒ๋ค์ด ์์ต๋๋ค.
- ํ ๋ญ์น์ ์ผ์ ์์ํ๊ธฐ ์ ์ ์ฃผ์์ผ๋ก ์ฌ์ฉ
- ์ฝ๋์ ๊ด๋ จ์๋ ํ๋ก์ ํธ ์์ ์ ํ ๋ ์ฃผ์์ผ๋ก ์ฌ์ฉ
- ์ ์ฅ์๋ฅผ ์ฌ์ฉํ๋ ์ฌ๋๊ณผ์ ๋ํ
- ๋์ค์ ๋ฆฌ๋ฒ ์ด์คํ์ง ์์ ์ ์ฅ์์ ์ฒซ ์ปค๋ฐ์ผ๋ก ์ฌ์ฉ
git commit -m "init repo" --allow-empty
.
$ git status
์ด๋ ๊ฒ ๋ฐ๋๋๋ค.
$ git status -sb
๊น status
์ปค๋งจ๋์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
์ด ๋ช ๋ น์ ์คํํ๋ฉด
$ 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 show :/query
query
์๋ ๊ฒ์ํ๊ณ ์ถ์ ๋ง์ (๋์๋ฌธ์๋ฅผ ๊ตฌ๋ถํด) ๋ฃ์ผ์ธ์. ์ฃผ์ด์ง ๊ฒ์์ด๊ฐ ์๋ ๊ฐ์ฅ ๋ง์ง๋ง ์ปค๋ฐ์ ํ์ํ๊ณ ๋ณ๊ฒฝ๋ ๋ผ์ธ์ ๋ณด์ฌ์ค๋๋ค.
$ git show :/typo
NOTE: ๋์ค๋ ค๋ฉด q
๋ฅผ ๋๋ฅด์ธ์.
$ git branch --merged
์ด ๋ช ๋ น์ด๋ ํ์ฌ ๋ธ๋์น์ ๋จธ์ง๋ ๋ชจ๋ ๋ธ๋์น์ ๋ชฉ๋ก์ ๋ณด์ฌ์ค๋๋ค.
๊ฑฐ๊พธ๋ก
$ git branch --no-merged
์ด ๋ช ๋ น์ด๋ ํ์ฌ ๋ธ๋์น์ ๋จธ์ง๋์ง ์์ ๋ธ๋์น์ ๋ชฉ๋ก์ ๋ณด์ฌ์ค๋๋ค.
๊น branch
์ปค๋งจ๋์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
๊น instaweb
์ปค๋งจ๋์ ์ฌ์ฉํ๋ฉด, ์ฆ์์์ gitweb
์์์ ์์
์ค์ธ ์ ์ฅ์๋ฅผ ๋๋ฌ ๋ณผ
์ ์์ต๋๋ค. ์ด ์ปค๋งจ๋๋ gitweb
๊ณผ ๋ก์ปฌ ์ ์ฅ์๋ฅผ ๋ธ๋ผ์ฐ์ง ํ๊ธฐ ์ํ ์น ์๋ฒ๋ฅผ ์ค์ ํ๋ ์คํฌ๋ฆฝํธ์
๋๋ค.
$ git instaweb
Opens:
๊น instaweb
์ปค๋งจ๋์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
.gitconfig
๋ ๋ชจ๋ ์ค์ ์ด ๋ค์ด์๋ ํ์ผ์
๋๋ค.
์๋ฆฌ์์ค๋ ์ปค์คํ
๊น ๋ช
๋ น์ด๋ฅผ ๋ฑ๋กํ ์ ์๋ ํผํผ์
๋๋ค. ์๋ฅผ ๋ค์ด 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' |
ํ์ฌ 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...
๊น ์ปค๋งจ๋ ๋ผ์ธ์ ์์ ๋ฃ์ผ๋ ค๋ฉด ์ด๋ ๊ฒ ํ์ธ์.
$ git config --global color.ui 1
๊น config
์ปค๋งจ๋์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
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 |
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 |