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
- Adjust Tab Space
- Commit History by Author
- Cloning a Repository
- Branch
- Gists
- Git.io
- Keyboard Shortcuts
- Line Highlighting in Repositories
- Closing Issues via Commit Messages
- Cross-Link Issues
- Locking Conversations
- CI Status on Pull Requests
- Filters
- Syntax Highlighting in Markdown Files
- Emojis
- Images/GIFs
- Quick Quoting
- Pasting Clipboard Image to Comments
- Quick Licensing
- Task Lists
- Relative Links
- Metadata and Plugin Support for GitHub Pages
- Viewing YAML Metadata in your Documents
- Rendering Tabular Data
- Rendering PDF
- Revert a Pull Request
- Diffs
- Hub
- Contribution Guidelines
- Octicons
- GitHub Resources
- Git
- Remove All Deleted Files from the Working Tree
- Previous Branch
- Stripspace
- SSH keys
- Checking out Pull Requests
- Empty Commits
- Styled Git Status
- Styled Git Log
- Git Query
- Git Grep
- Merged Branches
- Fixup and Autosquash
- Web Server for Browsing Local Repositories
- Git Configurations
- Git Resources
?w=1
๋ฅผ diff URL์ ์ถ๊ฐํ๋ฉด ๋ณ๊ฒฝ๋ ์ฝ๋๋ง ๋ณผ ์ ์๋๋ก, ๊ณต๋ฐฑ๋ง ๋ฐ๋ ์์ ์ ์ ๊ฑฐํ ์ ์์ต๋๋ค.
GitHub์ ๋น๋ฐ์ ๋ ์ฝ์ด ๋ณด์ธ์.
diff๋ ํ์ผ URL์ ?ts=4
๋ฅผ ๋ง๋ถ์ด๋ฉด ํญ ๋ฌธ์์ ํฌ๊ธฐ๋ฅผ ๊ธฐ๋ณธ๊ฐ์ธ ๊ณต๋ฐฑ 8๊ฐ ๋์ 4๊ฐ๋ก ๋ณด์ฌ์ค๋๋ค. ts
๋ค์ ์ซ์๋ ์ค์ ์ ๋ง๊ฒ ๋ณ๊ฒฝ ํ์ค ์ ์์ต๋๋ค. gist๋ raw ํ์ผ ๋ณด๊ธฐ์๋ ์ ์ฉ ๋์ง ์์ต๋๋ค๋ง, ํฌ๋กฌ ํ์ฅ ํ๋ก๊ทธ๋จ์ด๋ ์ผ๋ก ์๋ํ ํ ์ ์์ต๋๋ค.
์ฌ๊ธฐ์ ์๋ Go ์์ค ํ์ผ์ ?ts=4
๋ฅผ ๋ถ์ด๊ธฐ ์ ์๋ ์ด๋ ์ต๋๋ค.
๊ทธ๋ฆฌ๊ณ ?ts=4
๋ฅผ ๋ถ์ธ ๋ค์์๋ ์ด๋ ๊ฒ ๋ฉ๋๋ค.
ํน์ ์ปค๋ฏธํฐ๊ฐ ํ ๋ชจ๋ ์ปค๋ฐ์ ๋ณด๊ณ ์ถ๋ค๋ฉด URL์ ?author={user}
๋ฅผ ์ถ๊ฐํ์ธ์.
https://github.com/rails/rails/commits/master?author=dhh
์ปค๋ฐ ๋ทฐ๊ฐ์ ์ฐจ์ด์ ๋ํด ๋ ์ฝ์ด๋ณด์ธ์.
์ ์ฅ์๋ฅผ ํด๋ก ํ ๋, ๋งจ ๋ค์ .git
์ ์๋ตํ ์ ์์ต๋๋ค.
$ git clone https://github.com/tiimgreen/github-cheat-sheet
Git clone
๋ช
๋ น์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
์ ์ฅ์์ ๋ธ๋์น ํ์ด์ง๋, ์ปค๋ฐ ๋ฒํผ์ ๋ค์ ์์ต๋๋ค.
https://github.com/{user}/{repo}/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
{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
ํ์์ผ๋ก ์ ์ต๋๋ค
๋ธ๋์น๋ diff
๋ patch
๋ทฐ๋ก๋ ํ์ธํ ์ ์์ต๋๋ค.
https://github.com/rails/rails/compare/master...4-1-stable.diff
https://github.com/rails/rails/compare/master...4-1-stable.patch
์๊ฐ์ผ๋ก ์ปค๋ฐ์ ๋น๊ตํ๋ ๋ฒ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
ํฌํฌ๋ ์ ์ฅ์ ๊ฐ์ ๋ธ๋์น๋ฅผ ๋น๊ตํ๋ ค๋ฉด URL์ ์ด๋ ๊ฒ ๋ณ๊ฒฝํ์ธ์.
https://github.com/{user}/{repo}/compare/{foreign-user}:{branch}...{own-branch}
์๋ฅผ ๋ค๋ฉด
https://github.com/rails/rails/compare/byroot:idempotent-counter-caches...master
Gist๋ ๋ณธ๊ฒฉ์ ์ธ ์ ์ฅ์๋ฅผ ๋ง๋ค์ง ์๊ณ , ์์ ์ฝ๋ ์กฐ๊ฐ๊ณผ ์ผํ ์ ์๋ ์ฌ์ด ๋ฐฉ๋ฒ์ ๋๋ค.
์ด๋ ๊ฒ Gist URL ๋ค์ .pibb
๋ฅผ ๋ฃ์ผ๋ฉด ๋ค๋ฅธ ์ฌ์ดํธ์ ์ฒจ๋ถํ ์ ์๋ HTML ์จ๋ฆฌ ๋ฒ์ ์ ๋ง๋ค ์ ์์ต๋๋ค.
Gist๋ ์ ์ฅ์์ฒ๋ผ ์ทจ๊ธํ ์ ์๊ณ ํด๋ก ๋ ๋ฉ๋๋ค.
$ git clone https://gist.github.com/tiimgreen/10545817
์ด๋ Gists์์๋ ์์ ํ๊ณ ์ ๋ฐ์ดํธ๋ฅผ ํธ์ํ ์ ์๋ค๋ ์๋ฏธ์ ๋๋ค.
$ git commit
$ git push
Username for 'https://gist.github.com':
Password for 'https://tiimgreen@gist.github.com':
ํ์ง๋ง, Gists๋ ๋๋ ํฐ๋ฆฌ๋ฅผ ์ง์ํ์ง ์์ต๋๋ค. ๋ชจ๋ ํ์ผ์ ์ ์ฅ์์ ๋ฃจํธ์ ๋ฃ์ ํ์๊ฐ ์์ต๋๋ค. Gist๋ฅผ ๋ง๋๋ ๋ฒ์ ๋ํด ๋ ์ฝ์ด๋ณด์ธ์.
Git.io๋ GitHub๋ฅผ ์ํ ๊ฐ๋จํ URL ๋จ์ถ๊ธฐ์ ๋๋ค.
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์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
์ ์ฅ์ ํ์ด์ง์์ ๋จ์ถํค๋ฅผ ์ฌ์ฉํ๋ฉด ์ฝ๊ฒ ์ด๋ํ ์ ์์ต๋๋ค.
t
๋ฅผ ๋๋ฅด๋ฉด ํ์ผ ํ์ ํ์ด์ง๋ก ์ด๋ํฉ๋๋ค.w
๋ฅผ ๋๋ฅด๋ฉด ๋ธ๋์น ์ ํ ํ์ด์ง๋ก ์ด๋ํฉ๋๋ค.s
๋ฅผ ๋๋ฅด๋ฉด ํ์ฌ ์ ์ฅ์์ ๊ฒ์์ฐฝ์ผ๋ก ํฌ์ปค์ค๊ฐ ์ด๋ํฉ๋๋ค. ๋ฐฑ์คํ์ด์ค๋ฅผ ๋๋ฅด๋ฉด ์ฑ์์ ธ ์๋ "This repository"๋ฅผ ์ง์ GitHub ์ ์ฒด์์ ๊ฒ์ํ ์ ์๊ฒ ๋ฉ๋๋ค.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"
์ด๋ ๊ฒ ํ๋ฉด ์ด์๋ฅผ ๋ซ๊ณ ํด๋ก์ง ์ปค๋ฐ์ผ๋ก ์ฐธ์กฐํ๊ฒ ํฉ๋๋ค.
์ปค๋ฐ ๋ฉ์์ง๋ก ์ด์ ๋ซ๊ธฐ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
๊ฐ์ ์ ์ฅ์์ ๋ค๋ฅธ ์ด์๋ฅผ ๋งํฌํ๊ธฐ ์ํ๋ค๋ฉด, #
๋ค์ ์ด์ ๋ฒํธ๋ง ์
๋ ฅํ์๋ฉด ์๋์ผ๋ก ๋งํฌ๋ฉ๋๋ค.
๋ค๋ฅธ ์ ์ฅ์์ ์ด์๋ฅผ ๋งํฌํ๊ณ ์ถ๋ค๋ฉด {user}/{repo}#์ด์_๋ฒํธ
๋ก ํ ์ ์์ต๋๋ค. (์ tiimgreen/toc#12
)
ํ ๋ฆฌํ์คํธ์ ์ด์๋ ์ ์ฅ์์ ์ฃผ์ธ์ด๋ ํ์ ์๊ฐ ์ ๊ธ ์ ์์ต๋๋ค.
์ด๋ ํ๋ก์ ํธ์ ํ์ ์๊ฐ ์๋ ์ฌ๋์ ๋ ์ด์ ๋๊ธ์ ๋ฌ ์ ์๊ฒ ๋๋ค๋ ๋ง์ ๋๋ค.
๋ํ ์ ๊ทธ๊ธฐ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
์ ํํ ์ค์ ๋์๋ค๋ฉด, ํ ๋ฆฌํ์คํธ๋ฅผ ๋ฐ๊ฑฐ๋ ํ ๋ฆฌํ์คํธ์ ์๋ก์ด ์ปค๋ฐ์ ํ ๋๋ง๋ค, Travis CI๊ฐ ํ ๋ฆฌํ์คํธ๋ฅผ ๋น๋ ํ ๊ฒ์ ๋๋ค. Travis CI ์์ํ๊ธฐ๋ฅผ ์ข ๋ ์ฝ์ด๋ณด์ธ์.
์ปค๋ฐ ์ํ API์ ๋ํด ์ข ๋ ์ฝ์ด๋ณด์ธ์.
์ด์, ํ ๋ฆฌํ์คํธ ๋ ๋ค ์ ์ ์ธํฐํ์ด์ค์์ ํํฐ๋ง์ด ๊ฐ๋ฅํฉ๋๋ค.
๋ ์ผ์ค ์ ์ฅ์ 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 ๊ฒ์์ ๋ํด ์ข ๋ ์ฝ์ด๋ณด์ธ์.
๋งํฌ๋ค์ด์์ ์๋ฅผ ๋ค์ด, ๋ฃจ๋น ์ฝ๋๋ฅผ ์ ํ ์ค ํ์ด๋ผ์ดํธ ํ๋ ค๋ฉด ์ด๋ ๊ฒ ํฉ๋๋ค.
```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 ๋งํฌ๋ค์ด์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
์๋ชจ์ง๋ ํ ๋ฆฌํ์คํธ, ์ด์, ์ปค๋ฐ ๋ฉ์์ง, ์ ์ฅ์ ์ค๋ช
๋ฑ์ :์๋ชจ์ง์_์ด๋ฆ:
์ผ๋ก ๋ฃ์ ์ ์์ต๋๋ค.
GitHub์์ ์ฌ์ฉ ๊ฐ๋ฅํ ์๋ชจ์ง์ ์ ๋ชฉ๋ก์ emoji-cheat-sheet.com๋ scotch-io/All-GitHub-Emoji-Icons์์ ํ์ธํ์ค ์ ์์ต๋๋ค. ํธ๋ฆฌํ ์๋ชจ์ง ๊ฒ์ ์์ง์ emoji.muan.co์ ์์ต๋๋ค.
GitHub์์ ๋ง์ด ์ฌ์ฉํ๋ ์๋ชจ์ง ํ 5์๋ ์ด๋ ์ต๋๋ค.
:shipit:
:sparkles:
:-1:
:+1:
:clap:
๋๊ธ์ด๋ 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)
๋ชจ๋ ์ด๋ฏธ์ง๋ GitHub์์ ์บ์ํฉ๋๋ค. ๊ทธ๋์ ํธ์คํธ๊ฐ ์ฃฝ์ด๋ ์ด๋ฏธ์ง๋ ์ฌ์ ํ ๋จ์ต๋๋ค.
์ด๋ฏธ์ง๋ฅผ ์ํค ํ์ด์ง์ ๋ฃ๋ ๋ฐฉ๋ฒ์ ์ฌ๋ฟ ์์ต๋๋ค. ์์ ๋ณด์ด๋ ์ผ๋ฐ ๋งํฌ๋ค์ด ๋ฌธ๋ฒ๋ ์์ง๋ง, ์ด๋ฏธ์ง์ ๋์ด์ ๋์ด๋ฅผ ์ง์ ํ ์ ์๋ ๋ฌธ๋ฒ๋ ์์ต๋๋ค.
[[ http://www.sheawong.com/wp-content/uploads/2013/08/keephatin.gif | height = 100px ]]
์ด๋ ๊ฒ ๋ณด์ ๋๋ค.
์ค๋ ๋์ ๋ต๊ธ์ ๋ฌ ๋ ์ ์ ๋๊ฐ ๋งํ ์ด๋ค ๋ด์ฉ์ ์ธ์ฉํ๊ณ ์ถ๋ค๋ฉด, ํ
์คํธ๋ฅผ ํ์ด๋ผ์ดํธํ๊ณ r
์ ๋๋ฅด์ธ์. ์ด๋ ๊ฒ ํ๋ฉด ๋ด์ฉ์ ํ
์คํธ ๋ฐ์ค์ ์ธ์ฉ ํฌ๋งท์ผ๋ก ๋ณต์ฌํด ์ค๋๋ค.
๋น ๋ฅธ ์ธ์ฉ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
(ํฌ๋กฌ์์๋ง ๋์ํฉ๋๋ค)
์คํฌ๋ฆฐ์ท์ ์ฐ๊ณ ํด๋ฆฝ๋ณด๋์ ๋ณต์ฌํ ๊ฒฝ์ฐ (mac: cmd-ctrl-shift-4
), ๊ฐ๋จํ ์ด๋ฏธ์ง๋ฅผ ๋๊ธ ์์ญ์ ๋ถ์ฌ๋ฃ์(cmd-v / ctrl-v
) ์ ์๊ณ ์ด๋ ์๋์ผ๋ก GitHub์ ์
๋ก๋ ๋ฉ๋๋ค.
issue attachments์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
์ ์ฅ์๋ฅผ ๋ง๋ค ๋, GitHub๋ ๋ง๋ค์ด์ง ์ ์๊ถ์ ์ถ๊ฐํ ์ ์๋ ์ต์ ์ ์ ๊ณตํฉ๋๋ค.
์ด๋ฏธ ์๋ ์ ์ฅ์์๋ ์น ์ธํฐํ์ด์ค์์ ์ ํ์ผ์ ๋ง๋ค์ด ์ถ๊ฐํ ์ ์์ต๋๋ค.
์ด๋ฆ์ LICENSE
๋ฅผ ์
๋ ฅํ๋ฉด ์ต์
์ผ๋ก ํ
ํ๋ฆฟ์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
.gitignore
์๋ ๋๊ฐ์ด ์ ์ฉ๋ฉ๋๋ค.
์คํ ์์ค ์ ์๊ถ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
์ด์์ ํ ๋ฆฌํ์คํธ์์ ์๋์ ๋ฌธ๋ฒ์ผ๋ก ์ฒดํฌ๋ฐ์ค๋ฅผ ๋ฃ์ ์ ์์ต๋๋ค.(์คํ์ด์ค์ ์ฃผ์ํ์ธ์.)
- [ ] Be awesome
- [ ] Prepare dinner
- [ ] Research recipe
- [ ] Buy ingredients
- [ ] Cook recipe
- [ ] Sleep
์ฒดํฌ๋ฐ์ค๋ฅผ ํด๋ฆญํ๋ฉด, ์์ ๋งํฌ๋ค์ด์์ ๊ฐฑ์ ์ด ์ด๋ฃจ์ด์ง๋๋ค.
- [x] Be awesome
- [ ] Prepare dinner
- [x] Research recipe
- [x] Buy ingredients
- [ ] Cook recipe
- [ ] Sleep
ํ ์ผ ๋ชฉ๋ก์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
์ด์ ๋งํฌ๋ค์ด ๋ฌธ์์์ ์ฝ๊ธฐ ์ ์ฉ ์ฒดํฌ๋ฆฌ์คํธ๋ฅผ ๋ฃ์ ์ ์์ต๋๋ค.
- [ ] Mercury
- [x] Venus
- [x] Earth
- [x] Moon
- [x] Mars
- [ ] Deimos
- [ ] Phobos
- Mercury
- Venus
- Earth
- Moon
- Mars
- Deimos
- Phobos
๋งํฌ๋ค์ด ๋ฌธ์์์์ ํ ์ผ ๋ชฉ๋ก์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
์๋ ๊ฒฝ๋ก ๋งํฌ๋ ๋งํฌ๋ค์ด ํ์ผ์ด ๋ด๋ถ ์ฝํ ์ธ ๋ก ๋งํฌ๋ ๋ ์ถ์ฒํฉ๋๋ค.
[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 ํฌ๋ฉง์ ๋ฉํ๋ฐ์ดํฐ๋ฅผ ํ์๋ก ํฉ๋๋ค. GitHub๋ ์ด ๋ฉํ ์ ๋ณด๋ฅผ ์ฝ๊ธฐ ํธํ๊ฒ ํ ์ด๋ธ๋ก ํ์ํด ์ค๋๋ค.
๋ฌธ์์์ YAML ๋ฉํ๋ฐ์ดํฐ ๋ณด๊ธฐ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
GitHub๋ .csv
(comma-separated)์ .tsv
(tab-separated) ํ์ผ์ ๋ํด ํ(tabular) ๋ฐ์ดํฐ ๋ณด๊ธฐ๋ฅผ ์ง์ํฉ๋๋ค.
ํ ๋ฐ์ดํฐ ํ์์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
GitHub์์ PDF๋ฅผ ๋ ๋ํ ์ ์์ต๋๋ค.
PDF ๋ ๋๋ง์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
ํ ๋ฆฌํ์คํธ๊ฐ ๋จธ์ง๋ ํ์, ์๋ฌด ๋์์ด ์๋๊ฑฐ๋ ๋จธ์ง๊ฐ ์๋ชป๋ ๊ฒฐ์ ์ด์๋ค๋ ๊ฑธ ๋์น ์ฑ ๋๊ฐ ์์ต๋๋ค.
ํ ๋ฆฌํ์คํธ ํ์ด์ง์ ์ปค๋ฐ์ ์ค๋ฅธ์ชฝ์ ์๋ Revert ๋ฒํผ์ ํด๋ฆญํ๋ฉด ์ด ํ ๋ฆฌํ์คํธ๋ฅผ ๋๋๋ฆฌ๋ ํ ๋ฆฌํ์คํธ๋ฅผ ๋ง๋ค์ด ๋๋๋ฆด ์ ์์ต๋๋ค.
ํ ๋ฆฌํ์คํธ ๋๋๋ฆฌ๊ธฐ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
GitHub์์ ์ง์ํ๋ ์ฐ๋ฌธ(prose) ํ์ผ(์๋ฅผ ๋ค์ด Markdown)์ด ์๋ ์ปค๋ฐ๊ณผ ํ ๋ฆฌํ์คํธ์์๋ source์ rendered ๋ทฐ ๊ธฐ๋ฅ์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
"rendered" ๋ฒํผ์ ํด๋ฆญํ์๋ฉด ๋ ๋๋ ๋ฌธ์์์ ๋ณ๊ฒฝ์ ํ์ธํ์ค ์ ์์ต๋๋ค. ๋ ๋๋ ์ฐ๋ฌธ(prose) ๋ทฐ๋ ๋ฌธ์ฅ์ ์ถ๊ฐ, ์ญ์ , ๋ณ๊ฒฝํ์ ๋ ์ ์ฉํฉ๋๋ค.
๋ ๋๋ ์ฐ๋ฌธ(prose) diff์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
์ง์ค๋ฐ์ดํฐ๊ฐ ํฌํจ๋ ์ปค๋ฐ์ด๋ ํ ๋ฆฌํ์คํธ๋ฅผ ๋ณผ ๋๋ง๋ค GitHub๋ ๋ฌด์์ด ๋ณ๊ฒฝ ๋์๋์ง ์๊ฐ์ ์ผ๋ก ๋ณด์ฌ์ค๋๋ค.
diff ๊ฐ๋ฅํ ๋งต์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
diff์ ๋ซ์๋ ๊ณณ์ ํผ์นจ ๋ฒํผ์ ํด๋ฆญํ๋ฉด, ๋ฌธ๋งฅ์ ๋ ๋ณผ ์ ์์ต๋๋ค. ์ ์ฒด ํ์ผ์ ํ์ํ ๋๊น์ง ๊ณ์ ํผ์น ์ ์์ผ๋ฉฐ, GitHub์์ 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
(...)
GitHub๋ PNG, JPG, GIF, PSD๋ฅผ ํฌํจํ ์ฌ๋ฌ ์ผ๋ฐ์ ์ธ ์ด๋ฏธ์ง ํ์์ ํ์ํ ์ ์์ต๋๋ค. ์ถ๊ฐ์ ์ผ๋ก ์ด๋ฏธ์ง ํ์์ diff๋ฅผ ํ์ํ๋ ์ฌ๋ฌ ๋ฐฉ๋ฒ์ ์ ๊ณตํฉ๋๋ค.
[](https://github.com/blog/1845-psd-viewing-diffing
์ด๋ฏธ์ง diff์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
Hub๋ GitHub๋ฅผ ์ข ๋ ์ฝ๊ฒ ์ฌ์ฉํ ์ ์๋๋ก ์ถ๊ฐ ๊ธฐ๋ฅ ๋ฐ ๋ช ๋ น์ ์ ๊ณตํ๋ ์ปค๋งจ๋ ๋ผ์ธ Git ๋ํผ์ ๋๋ค.
์ด๋ ๊ฒ ํ ์ ์์ต๋๋ค.
$ hub clone tiimgreen/toc
Hub๊ฐ ์ ๊ณตํ๋ ๋ ๋ฉ์ง ๊ธฐ๋ฅ๋ค์ ํ์ธํด ๋ณด์ธ์.
GitHub๋ ํ๋ก์ ํธ์ ๊ธฐ์ฌํ๋ ์ฌ์ฉ์๋ฅผ ์ํ ์ธ ๊ฐ์ง ๊ฐ๊ธฐ ๋ค๋ฅธ ํ์ผ์ ์ง์ํฉ๋๋ค.
์ด ํ์ผ์ ์ ์ฅ์์ ์ ์ผ ์๋ ๊ทธ ์๋์ .github
๋๋ ํฐ๋ฆฌ์ ์์นํ ์ ์์ต๋๋ค.
์ ์ฅ์์ ์ ์ผ ์๋ ๊ทธ ์๋์ .github
๋๋ ํฐ๋ฆฌ์ CONTRIBUTING
์ด๋ CONTRIBUTING.md
ํ์ผ์ ๋ฃ์ด๋๋ฉด ๊ธฐ์ฌ์๊ฐ ์ด์๋ฅผ ๋ง๋ค๊ฑฐ๋ ํ ๋ฆฌํ์คํธ๋ฅผ ๋ง๋ค ๋ ๋งํฌ๋ก ๋ณด์ฌ์ค๋๋ค.
๊ธฐ์ฌํ๊ธฐ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
ํ๋ก์ ํธ์ ์๋ก์ด ์ด์์ ์ฌ์ฉ๋ ํ
ํ๋ฆฟ์ ์ง์ ํ ์ ์์ต๋๋ค. ์ฌ์ฉ์๊ฐ ์ ์ด์๋ฅผ ์์ฑํ๋ฉด ์ด์ ์ฐฝ์ด ์ด ํ์ผ์ ๋ด์ฉ์ผ๋ก ์ฑ์์ง๋๋ค. ์ ์ฅ์์ ์ ์ผ ์๋ ๊ทธ ์๋์ .github
๋๋ ํฐ๋ฆฌ์ ISSUE_TEMPLATE
์ด๋ ISSUE_TEMPLATE.md
ํ์ผ์ ๋ฃ์ด ๋์ธ์.
์ด์ ํ ํ๋ฆฟ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
์ด์ ํ ํ๋ฆฟ ํ์ผ ์์ฑ๊ธฐ
ํ๋ก์ ํธ์ ์๋ก์ด ํ ๋ฆฌํ์คํธ์ ์ฌ์ฉ๋ ํ
ํ๋ฆฟ์ ์ง์ ํ ์ ์์ต๋๋ค. ์ฌ์ฉ์๊ฐ ์ ํ ๋ฆฌํ์คํธ๋ฅผ ์์ฑํ๋ฉด ํ
์คํธ ์์ญ์ด ์ด ํ์ผ์ ๋ด์ฉ์ผ๋ก ์ฑ์์ง๋๋ค. ์ ์ฅ์์ ์ ์ผ ์๋ .github
๋๋ ํฐ๋ฆฌ์ PULL_REQUEST_TEMPLATE
์ด๋ PULL_REQUEST_TEMPLATE.md
ํ์ผ์ ๋ฃ์ด ๋์ธ์.
ํ ๋ฆฌํ์คํธ ํ ํ๋ฆฟ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
ํ ๋ฆฌํ์คํธ ํ ํ๋ฆฟ ํ์ผ ์์ฑ๊ธฐ
GitHub ์์ด์ฝ(์ฅํฐ์ฝ)์ด ์ด์ ์คํ์์ค๊ฐ ๋์์ต๋๋ค.
GitHub ์ฅํฐ์ฝ์ ๋ํด ๋ ์ฝ์ด๋ณด์ธ์.
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/ |
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 |
/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
Git์์ ์ด์ ๋ธ๋์น๋ก ๋์๊ฐ๋ ๊ฑด ์ด๋ ๊ฒ ํ ์ ์์ต๋๋ค.
$ git checkout -
# Switched to branch 'master'
$ git checkout -
# Switched to branch 'next'
$ git checkout -
# Switched to branch 'master'
Git ๋ธ๋์น์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
Git Stripspace๋ ์ด๋ฐ ์ผ์ ํฉ๋๋ค.
- ์ค ๋์ ๊ณต๋ฐฑ์ ์ ๊ฑฐ
- ๋น์ค์ ์ค์
- ํ์ผ ๋์ ๋น ์ค์ ์ถ๊ฐ
์ปค๋งจ๋๋ฅผ ์คํ ํ ๋ ํ์ผ์ ๋ฐ๋์ ์ด๋ฐ์์ผ๋ก ๋๊ฒจ์ค์ผ ํฉ๋๋ค.
$ git stripspace < README.md
Git stripspace
์ปค๋งจ๋์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
์๋ ์ฃผ์๋ฅผ ๋ฐฉ๋ฌธํ๋ฉด ๊ณต๊ฐ ssh ํค์ ๋ชฉ๋ก์ ์ผ๋ฐ ํ ์คํธ ํ์์ผ๋ก ๋ณผ ์ ์์ต๋๋ค.
https://github.com/{user}.keys
์: https://github.com/tiimgreen.keys
๊ณต๊ฐ ssh ํค ์ ๊ทผ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
ํ ๋ฆฌํ์คํธ๋ 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
ํ ๋ฆฌํ์คํธ๋ฅผ ๋ก์ปฌ๋ก ์ฒดํฌ์์ ํ๋ ๋ฐฉ๋ฒ์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
--allow-empty
๋ฅผ ์ถ๊ฐํ์๋ฉด ์ฝ๋์ ๋ณ๊ฒฝ ์์ด ์ปค๋ฐ์ ๋ฃ์ ์ ์์ต๋๋ค.
$ git commit -m "Big-ass commit" --allow-empty
์์ ๋ฒํ ์ฌ์ฉ๋ฒ์๋ ์ด๋ฐ ๊ฒ๋ค์ด ์์ต๋๋ค.
- ํ ๋ญ์น์ ์ผ์ ์์ํ๊ธฐ ์ ์ ์ฃผ์์ผ๋ก ์ฌ์ฉ
- ์ฝ๋์ ๊ด๋ จ์๋ ํ๋ก์ ํธ ์์ ์ ํ ๋ ์ฃผ์์ผ๋ก ์ฌ์ฉ
- ์ ์ฅ์๋ฅผ ์ฌ์ฉํ๋ ์ฌ๋๊ณผ์ ๋ํ
- ์ ์ฅ์์ ์ฒซ ์ปค๋ฐ์ผ๋ก ์ฌ์ฉ
git commit -m "Initial commit" --allow-empty
$ git status
-sb
๋ฅผ ์ถ๊ฐํ๋ฉด
$ git status -sb
์ด๋ ๊ฒ ๋ฐ๋๋๋ค.
Git 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: ์ด ๋ช ๋ น์ ์๋ฆฌ์์ค(๋จ์ถ ๋ช ๋ น)๋ก ๋ฃ์ ์ ์์ต๋๋ค. ์ฌ๊ธฐ์ ์๊ฐ๋ฅผ ๋ณด์ธ์.
Git log
์ปค๋งจ๋์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
Git ์ฟผ๋ฆฌ๋ ๋ชจ๋ ์ด์ ์ปค๋ฐ ๋ฉ์์ง์์ ๊ฒ์ํด ๊ฐ์ฅ ์ต๊ทผ์ ์ฟผ๋ฆฌ์ ๋ง๋ ์ปค๋ฐ์ ์ฐพ์์ค๋๋ค.
$ git show :/query
query
์๋ ๊ฒ์ํ๊ณ ์ถ์ ๋ง์ (๋์๋ฌธ์๋ฅผ ๊ตฌ๋ถํด) ๋ฃ์ผ์ธ์. ์ฃผ์ด์ง ๊ฒ์์ด๊ฐ ์๋ ๊ฐ์ฅ ๋ง์ง๋ง ์ปค๋ฐ์ ํ์ํ๊ณ ๋ณ๊ฒฝ๋ ๋ผ์ธ์ ๋ณด์ฌ์ค๋๋ค.
$ git show :/typo
๋์ค๋ ค๋ฉด q
๋ฅผ ๋๋ฅด์ธ์.
Git Grep์ ํจํด๊ณผ ์ผ์นํ๋ ์ค์ ๋ชฉ๋ก์ ๋ฐํํฉ๋๋ค.
๋ค์ ๋ช ๋ น์ ์คํํด ๋ณด์ธ์.
$ git grep aliases
aliases ๋ฌธ์์ด์ด ํฌํจ๋ ๋ชจ๋ ํ์ผ์ ๋ณด์ฌ์ค๋๋ค.
๋์ค๋ ค๋ฉด q
๋ฅผ ๋๋ฅด์ธ์.
์ฌ๋ฌ ํ๋๊ทธ๋ฅผ ์ด์ฉํด์ ์ข ๋ ๋ณต์กํ ๊ฒ์์ ํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค๋ฉด,
-e
๋ค์ ํ๋ผ๋ฏธํฐ๋ ํจํด (e.g. regex)--and
,--or
,--not
์ผ๋ก ์ฌ๋ฌ ํจํด์ ์กฐํฉ
์ด๋ ๊ฒ ์ฌ์ฉํ ์ ์์ต๋๋ค.
$ git grep -e pattern --and -e anotherpattern
Git grep
์ปค๋งจ๋์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
$ git branch --merged
์ด ๋ช ๋ น์ด๋ ํ์ฌ ๋ธ๋์น์ ๋จธ์ง๋ ๋ชจ๋ ๋ธ๋์น์ ๋ชฉ๋ก์ ๋ณด์ฌ์ค๋๋ค.
๊ฑฐ๊พธ๋ก
$ git branch --no-merged
์ด ๋ช ๋ น์ด๋ ํ์ฌ ๋ธ๋์น์ ๋จธ์ง๋์ง ์์ ๋ธ๋์น์ ๋ชฉ๋ก์ ๋ณด์ฌ์ค๋๋ค.
Git branch
์ปค๋งจ๋์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
์ด์ (HEAD์ ํ ๊ฐ ์ด์ ์ ์) ์ปค๋ฐ์ ์๋ชป๋ ๋ถ๋ถ์ด ์๋ค๋ฉด, ์๋ฅผ ๋ค์ด abcde
๋ผ๋ฉด,
๋ฌธ์ ๋ฅผ ์์ ํ๊ณ ๋ฐ์ ์ปค๋งจ๋๋ฅผ ์
๋ ฅํด ๊ณ ์น ์ ์์ต๋๋ค.
$ git commit --fixup=abcde
$ git rebase abcde^ --autosquash -i
Git commit
์ปค๋งจ๋์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
Git rebase
์ปค๋งจ๋์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
Git instaweb
์ปค๋งจ๋์ ์ฌ์ฉํ๋ฉด, ์ฆ์์์ gitweb
์์์ ์์
์ค์ธ ์ ์ฅ์๋ฅผ ๋๋ฌ ๋ณผ
์ ์์ต๋๋ค. ์ด ์ปค๋งจ๋๋ gitweb
๊ณผ ๋ก์ปฌ ์ ์ฅ์๋ฅผ ๋ธ๋ผ์ฐ์ง ํ๊ธฐ ์ํ ์น ์๋ฒ๋ฅผ ์ค์ ํ๋ ์คํฌ๋ฆฝํธ์
๋๋ค.
$ git instaweb
Opens:
Git instaweb
์ปค๋งจ๋์ ๋ํด ๋ ์ฝ์ด ๋ณด์ธ์.
.gitconfig
๋ ๋ชจ๋ ์ค์ ์ด ๋ค์ด์๋ ํ์ผ์
๋๋ค.
์๋ฆฌ์์ค๋ ์ปค์คํ
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)
ํ์ฌ 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 ์ปค๋งจ๋ ๋ผ์ธ์ ์์ ๋ฃ์ผ๋ ค๋ฉด ์ด๋ ๊ฒ ํ์ธ์.
$ git config --global color.ui 1
Git 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/ |
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 |
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 |
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 |
Title | Link |
---|---|
GitHub Flow | http://scottchacon.com/2011/08/31/github-flow.html |