1
0
mirror of https://github.com/tiimgreen/github-cheat-sheet.git synced 2025-02-23 05:12:24 +01:00
github-cheat-sheet/README.ko.md

953 lines
36 KiB
Markdown
Raw Normal View History

2014-04-14 23:22:47 +09:00
# 깃허브 치트 시트
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
A collection of cool hidden and not so hidden features of Git and GitHub. This cheat sheet was inspired by [Zach Holman](https://github.com/holman)'s [Git and GitHub Secrets](http://www.confreaks.com/videos/1229-aloharuby2012-git-and-github-secrets) talk at Aloha Ruby Conference 2012 ([slides](https://speakerdeck.com/holman/git-and-github-secrets)) and his [More Git and GitHub Secrets](https://vimeo.com/72955426) talk at WDCNZ 2013 ([slides](https://speakerdeck.com/holman/more-git-and-github-secrets)).
2014-04-14 18:57:03 +09:00
*Shortlink: [`http://git.io/sheet`](http://git.io/sheet)*
2014-04-28 21:12:10 +08:00
*Read this in other languages: [English](README.md), [한국어](README.ko.md), [日本語](README.ja.md), [简体中文](README.zh-cn.md).*
2014-04-24 10:40:07 +09:00
2014-04-14 23:22:47 +09:00
# 목록
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
- [GitHub](#github)
- [Ignore Whitespace](#ignore-whitespace)
2014-04-20 16:26:10 +09:00
- [Adjust Tab Space](#adjust-tab-space)
2014-04-15 16:23:45 +09:00
- [Commit History by Author](#commit-history-by-author)
- [Cloning a Repository](#cloning-a-repository)
2015-01-20 14:58:16 +09:00
- [Branch](#branch)
2014-07-06 16:54:56 +09:00
- [Compare all Branches to Another Branch](#compare-all-branches-to-another-branch)
- [Comparing Branches](#comparing-branches)
- [Compare Branches across Forked Repositories](#compare-branches-across-forked-repositories)
2014-04-15 16:23:45 +09:00
- [Gists](#gists)
- [Git.io](#gitio)
- [Keyboard Shortcuts](#keyboard-shortcuts)
- [Line Highlighting in Repositories](#line-highlighting-in-repositories)
- [Closing Issues via Commit Messages](#closing-issues-via-commit-messages)
- [Cross-Link Issues](#cross-link-issues)
2014-08-31 12:21:23 +09:00
- [Locking Conversations](#locking-conversations)
2014-04-17 08:40:05 +09:00
- [CI Status on Pull Requests](#ci-status-on-pull-requests)
2014-04-15 16:23:45 +09:00
- [Syntax Highlighting in Markdown Files](#syntax-highlighting-in-markdown-files)
- [Emojis](#emojis)
- [Images/GIFs](#imagesgifs)
- [Embedding Images in GitHub Wiki](#embedding-images-in-github-wiki)
- [Quick Quoting](#quick-quoting)
2015-01-20 14:58:16 +09:00
- [Pasting Clipboard Image to Comments](#pasting-clipboard-image-to-comments)
2014-04-15 16:23:45 +09:00
- [Quick Licensing](#quick-licensing)
- [Task Lists](#task-lists)
2014-04-29 23:44:19 +09:00
- [Task Lists in Markdown Documents](#task-lists-in-markdown-documents)
2014-04-15 16:23:45 +09:00
- [Relative Links](#relative-links)
- [Metadata and Plugin Support for GitHub Pages](#metadata-and-plugin-support-for-github-pages)
2014-04-19 11:14:26 +09:00
- [Viewing YAML Metadata in your Documents](#viewing-yaml-metadata-in-your-documents)
- [Rendering Tabular Data](#rendering-tabular-data)
2014-07-06 16:54:56 +09:00
- [Revert a Pull Request](#revert-a-pull-request)
2014-04-15 16:23:45 +09:00
- [Diffs](#diffs)
2014-08-31 12:21:23 +09:00
- [Rendered Prose Diffs](#rendered-prose-diffs)
2014-04-15 16:23:45 +09:00
- [Diffable Maps](#diffable-maps)
- [Expanding Context in Diffs](#expanding-context-in-diffs)
2014-04-17 08:40:05 +09:00
- [Diff or Patch of Pull Request](#diff-or-patch-of-pull-request)
2014-06-09 11:25:39 +09:00
- [Rendering and diffing images](#rendering-and-diffing-images)
2014-04-15 16:23:45 +09:00
- [Hub](#hub)
- [Contributing Guidelines](#contributing-guidelines)
2014-08-31 12:21:23 +09:00
- [Octicons](#octicons)
2014-04-17 08:40:05 +09:00
- [GitHub Resources](#github-resources)
- [GitHub Talks](#github-talks)
2014-04-15 16:23:45 +09:00
- [Git](#git)
- [Previous Branch](#previous-branch)
2014-04-17 08:40:05 +09:00
- [Stripspace](#stripspace)
2014-04-15 16:23:45 +09:00
- [Checking out Pull Requests](#checking-out-pull-requests)
- [Empty Commits :trollface:](#empty-commits-trollface)
- [Styled Git Status](#styled-git-status)
- [Styled Git Log](#styled-git-log)
- [Git Query](#git-query)
- [Merged Branches](#merged-branches)
2014-07-06 16:54:56 +09:00
- [Fixup and Autosquash](#fixup-and-autosquash)
2014-04-15 16:23:45 +09:00
- [Web Server for Browsing Local Repositories](#web-server-for-browsing-local-repositories)
- [Git Configurations](#git-configurations)
2014-04-14 18:57:03 +09:00
- [Aliases](#aliases)
2014-04-15 16:23:45 +09:00
- [Auto-Correct](#auto-correct)
2014-04-14 18:57:03 +09:00
- [Color](#color)
2014-04-17 08:40:05 +09:00
- [Git Resources](#git-resources)
- [Git Books](#git-books)
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
## GitHub
### Ignore Whitespace
2014-04-14 18:57:03 +09:00
`?w=1`를 diff URL에 추가하면 변경된 코드만 볼 수 있도록, 공백만 바뀐 수정을 제거할 수 있습니다.
2014-04-17 08:40:05 +09:00
![Diff without whitespace](https://camo.githubusercontent.com/797184940defadec00393e6559b835358a863eeb/68747470733a2f2f6769746875622d696d616765732e73332e616d617a6f6e6177732e636f6d2f626c6f672f323031312f736563726574732f776869746573706163652e706e67)
2014-04-14 23:22:47 +09:00
[*깃허브의 비밀을 더 읽어 보세요.*](https://github.com/blog/967-github-secrets)
2014-04-20 16:26:10 +09:00
### Adjust Tab Space
2015-01-28 10:10:21 +09:00
diff나 파일 URL에 `?ts=4`를 덧붙이면 텝 문자의 크기를 기본값인 8대신 4공백으로 보여줍니다. `ts`뒤의 숫자는 설정에 맞게 변경 하실 수 있습니다. gist나 raw파일 보기에는 적용 되지 않습니다만, [크롬 익스텐션](https://chrome.google.com/webstore/detail/github-tab-size/ofjbgncegkdemndciafljngjbdpfmbkn)이나 [오페라 익스텐션](https://addons.opera.com/en/extensions/details/github-tab-size/)으로 자동화 할 수 있습니다.
2014-04-20 16:26:10 +09:00
2015-01-20 14:58:16 +09:00
여기에 있는 Go 소스 파일은 `?ts=4`를 붙이기 전에는 이렇습니다.
2014-04-20 16:26:10 +09:00
![Before, tab space example](http://i.imgur.com/GIT1Fr0.png)
2015-01-20 14:58:16 +09:00
그리고 `?ts=4`를 붙인 다음에는 이렇게 됩니다.
2014-04-24 10:40:07 +09:00
--allow-empty
2014-04-20 16:26:10 +09:00
![After, tab space example](http://i.imgur.com/70FL4H9.png)
2014-04-15 16:23:45 +09:00
### Commit History by Author
특정 커미터가 한 모든 커밋을 보고 싶다면 URL에 `?author={user}`를 추가하세요.
2014-04-15 16:23:45 +09:00
```
https://github.com/rails/rails/commits/master?author=dhh
```
2015-01-20 14:58:16 +09:00
![DHH commit history](http://i.imgur.com/S7AE29b.png)
2014-04-17 08:40:05 +09:00
2014-04-15 16:23:45 +09:00
[*커밋 뷰간의 차이에 대해 더 읽어보세요.*](https://help.github.com/articles/differences-between-commit-views)
### Cloning a Repository
2014-04-14 18:57:03 +09:00
저장소를 클론할 때, 맨 뒤의 `.git`은 생략할 수 있습니다.
```bash
$ git clone https://github.com/tiimgreen/github-cheat-sheet
```
2014-04-14 23:22:47 +09:00
[*깃 `clone` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-clone)
2014-07-06 16:54:56 +09:00
###Branch
#### Compare all Branches to Another Branch
2014-05-09 11:00:48 +09:00
저장소의 [브랜치](https://github.com/tiimgreen/github-cheat-sheet/branches) 페이지는, 커밋 버튼의 뒤에 있습니다.
```
https://github.com/{user}/{repo}/branches
```
... 메인 브랜치에 머지되지 않은 모든 브랜치의 리스트를 볼 수 있습니다.
여기에서 버튼 클릭으로 비교 페이지나 브랜치 삭제를 하실 수 있습니다.
2015-01-20 14:58:16 +09:00
![Compare branches not merged into master in rails/rails repo - https://github.com/rails/rails/branches](http://i.imgur.com/0FEe30z.png)
2014-05-09 11:00:48 +09:00
2014-07-06 16:54:56 +09:00
#### Comparing Branches
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
깃허브에서 브랜치 비교를 하시려면, URL을 이런 식으로 바꾸세요.
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
```
https://github.com/{user}/{repo}/compare/{range}
2014-04-14 18:57:03 +09:00
```
2014-04-15 16:23:45 +09:00
`{range}``master...4-1-stable`식으로 적습니다.
2014-04-14 18:57:03 +09:00
2014-04-17 08:40:05 +09:00
예를 들어
2014-04-15 16:23:45 +09:00
```
https://github.com/rails/rails/compare/master...4-1-stable
2014-04-14 18:57:03 +09:00
```
2015-01-20 14:58:16 +09:00
![Rails branch compare example](http://i.imgur.com/tIRCOsK.png)
2014-04-17 08:40:05 +09:00
2014-04-15 16:23:45 +09:00
`{range}` 는 이렇게 적을 수도 있습니다.
2014-04-14 23:22:47 +09:00
2014-04-15 16:23:45 +09:00
```
https://github.com/rails/rails/compare/master@{1.day.ago}...master
https://github.com/rails/rails/compare/master@{2014-10-04}...master
```
2014-04-14 23:22:47 +09:00
2014-04-17 08:40:05 +09:00
*날짜는 `YYYY-DD-MM`형식으로 적습니다*
![Another compare example](http://i.imgur.com/5dtzESz.png)
2015-01-28 10:10:21 +09:00
브랜치는 `diff``patch`뷰로도 확인할 수 있습니다.
```
https://github.com/rails/rails/compare/master...4-1-stable.diff
https://github.com/rails/rails/compare/master...4-1-stable.patch
```
2014-04-14 23:22:47 +09:00
2014-04-15 16:23:45 +09:00
[*시간으로 커밋을 비교하는 법에 대해 더 읽어 보세요.*](https://help.github.com/articles/comparing-commits-across-time)
2014-04-14 23:22:47 +09:00
2014-07-06 16:54:56 +09:00
#### Compare branches across forked repositories
2014-04-14 23:22:47 +09:00
2014-04-15 16:23:45 +09:00
포크된 저장소간의 브랜치를 비교하려면 URL을 이렇게 변경하세요.
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
```
2015-01-20 14:58:16 +09:00
https://github.com/{user}/{repo}/compare/{foreign-user}:{branch}...{own-branch}
2014-04-15 16:23:45 +09:00
```
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
예를 들면
```
https://github.com/rails/rails/compare/byroot:idempotent-counter-caches...master
2014-04-14 18:57:03 +09:00
```
2014-04-17 08:40:05 +09:00
![Forked branch compare](http://i.imgur.com/Q1W6qcB.png)
2014-04-15 16:23:45 +09:00
### Gists
2014-04-14 18:57:03 +09:00
2014-04-17 08:40:05 +09:00
[Gists](https://gist.github.com/)는 본격적인 저장소를 만들지 않고, 작은 코드 조각과 일할 수 있는 쉬운 방법입니다.
![Gist](http://i.imgur.com/VkKI1LC.png?1)
[이렇게](https://gist.github.com/tiimgreen/10545817.pibb) Gist URL뒤에 `.pibb`를 넣으면 다른 사이트에 넣을수 있는 *HTML 온리* 버전을 만들 수 있습니다.
2014-04-14 18:57:03 +09:00
2015-01-28 10:10:21 +09:00
Gists는 저장소처럼 취급할 수 있고 클론도 됩니다.
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
```bash
$ git clone https://gist.github.com/tiimgreen/10545817
2014-04-14 18:57:03 +09:00
```
2015-01-20 14:58:16 +09:00
![Gists](http://i.imgur.com/BcFzabp.png)
2014-04-14 23:22:47 +09:00
2015-01-20 14:58:16 +09:00
이는 Gists에서도 수정하고 업데이트를 푸쉬할 수 있다는 의미입니다.
```bash
$ git commit
Username for 'https://gist.github.com':
Password for 'https://tiimgreen@gist.github.com':
```
2015-01-28 10:10:21 +09:00
하지만, Gists는 디랙토리를 지원하지 않습니다. 모든 파일은 저장소의 루트에 넣을 필요가 있습니다.
[*Gist를 만드는 법에 대해 더 읽어보세요.*](https://help.github.com/articles/creating-gists)
2014-04-15 16:23:45 +09:00
### Git.io
2014-04-14 18:57:03 +09:00
2014-04-17 08:40:05 +09:00
[Git.io](http://git.io)는 깃허브를 위한 간단한 URL 단축기입니다.
![Git.io](http://i.imgur.com/6JUfbcG.png?1)
순수 HTTP에서 Curl으로 사용하실 수도 있습니다.
2014-04-14 18:57:03 +09:00
2014-04-14 23:53:22 +09:00
```bash
$ 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/...
```
2014-04-14 18:57:03 +09:00
2014-04-14 23:22:47 +09:00
[*Git.io에 대해 더 읽어 보세요.*](https://github.com/blog/985-git-io-github-url-shortener)
2014-04-15 16:23:45 +09:00
### Keyboard Shortcuts
2014-04-14 18:57:03 +09:00
저장소 페이지에서 단축키를 사용하면 쉽게 이동할 수 있습니다.
2014-04-15 16:23:45 +09:00
- `t`를 누르면 파일 탐색 페이지로 이동합니다.
- `w`를 누르면 브렌치 선택 페이지로 이동합니다.
2015-01-28 10:10:21 +09:00
- `s`를 누르면 지금 저장소의 검색창이 포커스됩니다. 백스페이스를 누르면 채워져 있는 "This repository"를 지워 GitHub전체에서 검색할 수 있게 됩니다.
2014-04-15 16:23:45 +09:00
- `l`를 누르면 있는 이슈의 라벨을 수정할 수 있습니다.
- __파일을 보고 있을 때__ (예를 들어 `https://github.com/tiimgreen/github-cheat-sheet/blob/master/README.md`) `y`를 누르면 URL을 지금 보고 있는 페이지를 사실상 고정하도록 합니다. 코드가 바뀐다고 해도 이번에 본 내용을 다시 볼 수 있습니다.
2014-04-14 18:57:03 +09:00
지금 페이지에서 쓸 수 있는 모든 단축키를 보시려면 `?`를 누르세요.
2014-04-17 08:40:05 +09:00
![Keyboard shortcuts](http://i.imgur.com/y5ZfNEm.png)
2015-01-28 10:10:21 +09:00
[*사용할 수 있는 검색 문법에 대해 더 읽어 보세요.*](https://help.github.com/articles/search-syntax/)
2014-04-14 23:22:47 +09:00
2014-04-15 16:23:45 +09:00
### Line Highlighting in Repos
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
코드 파일 URL의 끝에 `#L52`를 추가하거나 줄 번호를 클릭하면 그 줄 번호를 하이라이트합니다.
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
`#L53-L60`처럼 범위지정도 가능합니다. 범위를 지정하려면 `shift`키를 누른 채 두 라인을 클릭하면 됩니다.
2014-04-14 18:57:03 +09:00
```
2014-04-15 16:23:45 +09:00
https://github.com/rails/rails/blob/master/activemodel/lib/active_model.rb#L53-L60
2014-04-14 18:57:03 +09:00
```
2014-04-15 16:23:45 +09:00
![Line Highlighting](http://i.imgur.com/8AhjrCz.png)
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
### Closing Issues with Commits
2014-04-14 18:57:03 +09:00
2014-04-18 09:09:24 +09:00
어떤 커밋이 이슈를 고쳤다면, `fix/fixes/fixed`, `close/closes/closed`, `resolve/resolves/resolved`를 키워드로 해당 이슈가 마스터 브랜치에 커밋 될 때 닫을 수 있습니다.
2014-04-14 18:57:03 +09:00
```bash
2014-04-24 10:40:07 +09:00
$ git commit -m "Fix screwup, fixes #12"
2014-04-14 18:57:03 +09:00
```
2014-04-15 16:23:45 +09:00
이렇게 하면 이슈를 닫고 클로징 커맨트로 참조하게 합니다.
2014-04-14 18:57:03 +09:00
2014-04-24 10:40:07 +09:00
![Closing Repo](http://i.imgur.com/Uh1gZdx.png)
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
[*커밋 메세지로 이슈 닫기에 대해 더 읽어 보세요.*](https://help.github.com/articles/closing-issues-via-commit-messages)
2014-04-14 23:22:47 +09:00
2014-04-15 16:23:45 +09:00
### Cross-Link Issues
2014-04-14 18:57:03 +09:00
같은 저장소의 다른 이슈를 링크하기 원한다면, `#`뒤에 이슈 번호만 입력하시면 자동으로 링크됩니다.
다른 저장소의 이슈를 링크하고 싶다면 `{user}/{repo}#이슈_번호`로 할 수 있습니다. (예 `tiimgreen/toc#12`)
2014-04-14 18:57:03 +09:00
2014-04-14 23:53:22 +09:00
![Cross-Link Issues](https://camo.githubusercontent.com/447e39ab8d96b553cadc8d31799100190df230a8/68747470733a2f2f6769746875622d696d616765732e73332e616d617a6f6e6177732e636f6d2f626c6f672f323031312f736563726574732f7265666572656e6365732e706e67)
2014-08-31 12:21:23 +09:00
### Locking Conversations
풀 리퀘스트와 이슈는 레포지터리의 주인이나 협업자에 의해 잠글 수 있습니다.
![Lock conversation](https://cloud.githubusercontent.com/assets/2723/3221693/bf54dd44-f00d-11e3-8eb6-bb51e825bc2c.png)
2015-01-28 10:10:21 +09:00
이는 프로젝트의 협업자가 아닌 사람은 더 이상 커맨트를 달 수 없게된다는 말입니다.
2014-08-31 12:21:23 +09:00
![Comments locked](https://cloud.githubusercontent.com/assets/2723/3221775/d6e513b0-f00e-11e3-9721-2131cb37c906.png)
[*대화 잠그기에 대해 더 읽어 보세요.*](https://github.com/blog/1847-locking-conversations)
2014-04-17 08:40:05 +09:00
### CI Status on Pull Requests
정확히 설정되었다면, 풀 리퀘스트를 받거나 풀 리퀘스트에 새로운 커밋을 할 때 마다, [Travis CI](https://travis-ci.org/)가 풀 리퀘스트를 빌드 할 것입니다. [Travis CI 시작하기](http://docs.travis-ci.com/user/getting-started/)를 좀 더 읽어보세요.
2014-05-01 19:19:47 -04:00
[![Travis CI status](https://cloud.githubusercontent.com/assets/1687642/2700187/3a88838c-c410-11e3-9a46-e65e2a0458cd.png)](https://github.com/octokit/octokit.rb/pull/452)
2014-04-17 08:40:05 +09:00
[*커밋 상태 API에 대해 좀 더 읽어보세요.*](https://github.com/blog/1227-commit-status-api)
2014-04-15 16:23:45 +09:00
### Syntax Highlighting in Markdown Files
2014-04-14 18:57:03 +09:00
마크다운에서 예를 들어, 루비 코드를 신텍스 하이라이트 하려면 이렇게 합니다.
```ruby
require 'tabbit'
table = Tabbit.new('Name', 'Email')
table.add_row('Tim Green', 'tiimgreen@gmail.com')
puts table.to_s
```
이렇게 보입니다.
```ruby
require 'tabbit'
table = Tabbit.new('Name', 'Email')
table.add_row('Tim Green', 'tiimgreen@gmail.com')
puts table.to_s
```
깃허브는 [Linguist](https://github.com/github/linguist)를 사용해 언어를 감지하고 신텍스를 하이라이트합니다. [언어 YAML 파일](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml)을 정독하시면 어떤 키워드가 유효한지 확인하실 수 있습니다.
2014-04-14 23:22:47 +09:00
[*깃허브 Flavored 마크다운에 대해 더 읽어 보세요.*](https://help.github.com/articles/github-flavored-markdown)
2014-04-15 16:23:45 +09:00
### Emojis
2014-04-14 18:57:03 +09:00
2015-01-20 14:58:16 +09:00
에모지는 풀 리퀘스트, 이슈, 커밋 메세지등에 `:에모지의_이름:`으로 넣을 수 있습니다.
2014-04-14 18:57:03 +09:00
2014-04-17 08:40:05 +09:00
깃허브에서 사용 가능한 에모지의 전 목록은 [emoji-cheat-sheet.com](http://www.emoji-cheat-sheet.com/) 나 [scotch-io/All-Github-Emoji-Icons](https://github.com/scotch-io/All-Github-Emoji-Icons)에서 확인하실 수 있습니다.
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
깃허브에서 많이 사용하는 에모지 탑 5위는 이렇습니다.
2014-04-14 18:57:03 +09:00
1. `:shipit:`
2. `:sparkles:`
3. `:-1:`
4. `:+1:`
5. `:clap:`
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
### Images/GIFs
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
커맨트나 README등등에 이미지와 GIF를 넣을 수 있습니다.
2014-04-14 18:57:03 +09:00
```
2014-04-15 16:23:45 +09:00
![Alt Text](http://www.sheawong.com/wp-content/uploads/2013/08/keephatin.gif)
2014-04-14 18:57:03 +09:00
```
2014-08-31 12:21:23 +09:00
저장소에 있는 이미지는 직접 불러서 사용할 수 있습니다.
```
![Alt Text](https://github.com/{user}/{repo}/raw/master/path/to/image.gif)
2014-08-31 12:21:23 +09:00
```
2014-04-15 16:23:45 +09:00
![Peter don't care](http://www.sheawong.com/wp-content/uploads/2013/08/keephatin.gif)
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
모든 이미지는 GitHub에서 케쉬합니다. 그래서 호스트가 죽어도 이미지는 여전히 남습니다.
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
#### Embedding Images in GitHub Wiki
2014-04-14 18:57:03 +09:00
2014-06-01 18:59:02 -06:00
이미지를 위키 페이지에넣는 방법은 여럿 있습니다. 위에 보이는 일반 마크다운 문법도 있지만, 이미지에 높이와 넓이를 지정할 수 있는 문법도 있습니다.
2014-04-15 16:23:45 +09:00
```markdown
[[ http://www.sheawong.com/wp-content/uploads/2013/08/keephatin.gif | height = 100px ]]
2014-04-14 18:57:03 +09:00
```
2014-04-15 16:23:45 +09:00
이렇게 보입니다.
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
![Just a screenshot](http://i.imgur.com/J5bMf7S.png)
2014-04-14 23:22:47 +09:00
2014-04-15 16:23:45 +09:00
### Quick Quoting
2014-04-14 23:22:47 +09:00
2014-04-15 16:23:45 +09:00
스레드에 답글들 때 전에 누가 말한 어떤 내용을 인용하고 싶다면, 텍스트를 하이라이트하고 `r`을 누르세요. 이렇게 하면 내용을 텍스트 박스에 인용 포맷으로 복사해 줍니다.
![Quick Quote](https://f.cloud.github.com/assets/296432/124483/b0fa6204-6ef0-11e2-83c3-256c37fa7abc.gif)
[*빠른 인용에 대해 더 읽어 보세요.*](https://github.com/blog/1399-quick-quotes)
2015-01-20 14:58:16 +09:00
### Pasting Clipboard Image to Comments
_(크롬에서만 동작합니다)_
2015-01-20 14:58:16 +09:00
스크린샷을 찍고 클립보드에 있는 경우 (mac: `cmd-ctrl-shift-4`), 간단히 이미지를 커맨트 색션에 붙여넣기(`cmd-v / ctrl-v`)할 수 있고 이는 자동으로 깃허브에 업로드 됩니다.
![Pasting Clipboard Image to Comments](https://cloud.githubusercontent.com/assets/39191/5794265/39c9b65a-9f1b-11e4-9bc7-04e41f59ea5f.png)
[*issue attachments에 대해 더 읽어 보세요.*](https://help.github.com/articles/issue-attachments)
2014-04-15 16:23:45 +09:00
### Quick Licensing
저장소를 만들 때, 깃허브는 만들어진 저작권을 추가할 수 있는 옵션을 제공합니다.
2014-04-16 11:07:57 +09:00
![License](http://i.imgur.com/Chqj4Fg.png)
2014-04-15 16:23:45 +09:00
이미 있는 저장소에도 웹 인터페이스에서 새 파일을 만들어 추가할 수 있습니다.
이름에 `LICENSE`를 입력하면 옵션으로 템플릿을 사용할 수 있습니다.
![License](http://i.imgur.com/fTjQict.png)
`.gitignore`에도 똑같이 적용됩니다.
[*오픈 소스 저작권에 대해 더 읽어 보세요.*](https://help.github.com/articles/open-source-licensing)
### Task Lists
이슈와 풀 리퀘스트에서 밑의 문법으로 체크박스를 넣을 수 있습니다.(스페이스에 주의하세요.)
2014-04-14 23:22:47 +09:00
```
2014-04-15 16:23:45 +09:00
- [ ] Be awesome
- [ ] Prepare dinner
- [ ] Research recipe
- [ ] Buy ingredients
- [ ] Cook recipe
2014-04-15 16:23:45 +09:00
- [ ] Sleep
2014-04-14 23:22:47 +09:00
```
![Task List](http://i.imgur.com/jJBXhsY.png)
2014-04-15 16:23:45 +09:00
체크박스가 클릭 되면, 순수 마크다운에서 갱신이 이루어집니다.
2014-04-14 23:22:47 +09:00
```
2014-04-15 16:23:45 +09:00
- [x] Be awesome
- [ ] Prepare dinner
- [x] Research recipe
- [x] Buy ingredients
- [ ] Cook recipe
2014-04-15 16:23:45 +09:00
- [ ] Sleep
2014-04-14 23:22:47 +09:00
```
[*테스크 리스트에 대해 더 읽어 보세요.*](https://help.github.com/articles/writing-on-github#task-lists)
2014-04-14 18:57:03 +09:00
2014-04-29 23:44:19 +09:00
#### Task Lists in Markdown Documents
이제 마크다운 문서에서 **읽기 전용** 체크리스트를 넣을 수 있습니다.
```
- [ ] Mercury
- [x] Venus
- [x] Earth
- [x] Mars
- [ ] Jupiter
```
- [ ] Mercury
- [x] Venus
- [x] Earth
- [x] Mars
- [ ] Jupiter
[*마크다운 문서에서의 테스크 리스트에 대해 더 읽어 보세요.*](https://github.com/blog/1825-task-lists-in-all-markdown-documents)
2014-04-15 16:23:45 +09:00
### Relative Links
2014-04-14 18:57:03 +09:00
2014-06-01 18:59:02 -06:00
상대 경로 링크는 마크다운 파일이 내부 컨텐츠로 링크될 때 추천합니다.
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
```markdown
[Link to a header](#awesome-section)
[Link to a file](docs/readme)
2014-04-14 18:57:03 +09:00
```
2014-04-15 16:23:45 +09:00
절대 경로 링크는 URL이 변경 될 때 마다 변경해야 합니다. (예를 들어 저장소 이름 변경, 유저이름 변경, 프로젝트 포크)
상대 경로 링크를 사용하면 문서를 쉽게 스스로 독립적으로 만들 수 있습니다.
[*상대 경로 링크에 대해 더 읽어 보세요.*](https://help.github.com/articles/relative-links-in-readmes)
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
### Metadata and Plugin Support for GitHub Pages
2014-04-14 23:22:47 +09:00
지킬로 작성된 페이지와 포스트에서, 저장소 정보는 예를 들어 `{{ site.github.project_title }}`처럼 `site.github` 이름 공간으로 사용하고 표시할 수 있습니다.
Jemoji와 jekyll-mentions플러그인은 GitHub.com에서 처럼 [emoji](#emojis)와 [@mentions](https://github.com/blog/821)을 지킬 포스트와 페이지에서 사용하게 합니다.
2014-04-17 08:40:05 +09:00
[*저장소 메타 데이타와 깃허브 페이지의 플러그인 지원에 대해 더 읽어 보세요.*](https://github.com/blog/1797-repository-metadata-and-plugin-support-for-github-pages)
2014-04-14 23:22:47 +09:00
2014-04-19 11:14:26 +09:00
### Viewing YAML Metadata in your Documents
[Jekyll](http://jekyllrb.com/)이나 [GitHub Pages](http://pages.github.com/)같은 많은 블로그에서 포스트의 처음에 YAML 포멧의 메타데이터를 필요로 합니다. 깃허브는 이 메타 정보를 읽기 편하게 테이블로 표시해 줍니다.
![YAML metadata](https://camo.githubusercontent.com/47245aa16728e242f74a9a324ce0d24c0b916075/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f36343035302f313232383236372f65303439643063362d323761302d313165332d396464382d6131636432323539393334342e706e67)
[*문서에서 YAML 메타데이터 보기에 대해 더 읽어 보세요.*](https://github.com/blog/1647-viewing-yaml-metadata-in-your-documents)
### Rendering Tabular Data
깃허브는 `.csv` (comma-separated) 와 `.tsv` (tab-separated)파일에 대해 표(tabular) 데이터 보기를 지원합니다.
![Tabular data](https://camo.githubusercontent.com/1b6dd0157ffb45d9939abf14233a0cb13b3b4dfe/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f3238323735392f3937363436322f33323038336463652d303638642d313165332d393262322d3566323863313061353035392e706e67)
[*표 데이타 표시에 대해 더 읽어 보세요.*](https://github.com/blog/1601-see-your-csvs)
2014-08-31 12:21:23 +09:00
### Revert a Pull Request
2014-07-06 16:54:56 +09:00
풀 리퀘스트가 머지된 후에, 아무 도움이 안되거나 머지가 잘못된 결정이었다는 걸
눈치 챌 때가 있습니다.
풀 리퀘스트 페이지의 커밋의 오른 쪽에 있는 **Revert** 버튼을 클릭하면 이 풀리퀘스트를 되돌리는 풀리퀘스트를 만들어 되돌릴 수 있습니다.
2014-04-14 23:53:22 +09:00
2014-07-06 16:54:56 +09:00
![Revert button](https://camo.githubusercontent.com/0d3350caf2bb1cba53123ffeafc00ca702b1b164/68747470733a2f2f6769746875622d696d616765732e73332e616d617a6f6e6177732e636f6d2f68656c702f70756c6c5f72657175657374732f7265766572742d70756c6c2d726571756573742d6c696e6b2e706e67)
2014-08-31 12:21:23 +09:00
[*풀 리퀘스트 되돌리기에 대해 더 읽어 보세요.*](https://github.com/blog/1857-introducing-the-revert-button)
2014-07-06 16:54:56 +09:00
### Diffs
2014-04-15 16:23:45 +09:00
#### Rendered Prose Diffs
2014-04-14 23:53:22 +09:00
2014-08-31 12:21:23 +09:00
GitHub에서 지원하는 산문(prose) 파일(예를 들어 Markdown)이 있는 커밋과 풀 리퀘스트에서는 *source*와 *rendered* 뷰 기능을 사용할 수 있습니다.
2014-04-15 16:23:45 +09:00
![Source / Rendered view](https://github-images.s3.amazonaws.com/help/repository/rendered_prose_diff.png)
"rendered" 버튼을 클릭하시면 렌더된 문서에서 변경을 확인하실 수 있습니다. 렌더된 산문(prose) 뷰는 문장을 추가, 삭제, 변경했을때 유용합니다.
2014-04-14 23:53:22 +09:00
![Rendered Prose Diffs](https://f.cloud.github.com/assets/17715/2003056/3997edb4-862b-11e3-90be-5e9586edecd7.png)
[*렌더된 산문(prose) diff에 대해 더 읽어 보세요.*](https://github.com/blog/1784-rendered-prose-diffs)
2014-04-15 16:23:45 +09:00
#### Diffable Maps
2014-04-14 23:53:22 +09:00
지오데이타가 포함된 커밋이나 풀 리퀘스트를 볼 때마다 깃허브는 무엇이 변경 되었는지 시각적으로 보여줍니다.
[![Diffable Maps](https://f.cloud.github.com/assets/282759/2090660/63f2e45a-8e97-11e3-9d8b-d4c8078b004e.gif)](https://github.com/benbalter/congressional-districts/commit/2233c76ca5bb059582d796f053775d8859198ec5)
[*diff 가능한 맵에 대해 더 읽어 보세요.*](https://github.com/blog/1772-diffable-more-customizable-maps)
2014-04-15 16:23:45 +09:00
#### Expanding Context in Diffs
2014-04-14 23:53:22 +09:00
2014-04-15 16:23:45 +09:00
diff의 닫아둔 곳의 *펼침* 버튼을 클릭하면, 문맥을 더 볼 수 있습니다. 전채 파일을 표시할때까지 계속 *펼칠* 수 있으며, 깃허브에서 diff가 표시되는 장소라면 어디서든 사용가능합니다.
2014-04-14 23:53:22 +09:00
![Expanding Context in Diffs](https://f.cloud.github.com/assets/22635/1610539/863c1f64-5584-11e3-82bf-151b406a272f.gif)
[*diff에서의 문맥 확장에 대해 더 읽어 보세요.*](https://github.com/blog/1705-expanding-context-in-diffs)
2014-04-17 08:40:05 +09:00
#### Diff or Patch of Pull Request
2014-04-14 18:57:03 +09:00
2014-04-17 08:40:05 +09:00
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
```
2014-04-15 16:23:45 +09:00
2014-04-17 08:40:05 +09:00
`.diff` 확장자는 이런 내용의 평범한(plain) 텍스트를 줍니다.
2014-04-14 18:57:03 +09:00
```
2014-04-17 08:40:05 +09:00
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
(...)
```
2014-06-09 11:25:39 +09:00
#### Rendering and diffing images
깃허브는 PNG, JPG, GIF, PSD를 포함한 여러 일반 적인 이미지 형식을 표시할 수 있습니다. 추가적으로 이미지 형식의 diff를 표시하는 여러 방법을 제공합니다.
[![Diffable PSD](https://cloud.githubusercontent.com/assets/2546/3165594/55f2798a-eb56-11e3-92e7-b79ad791a697.gif)](https://github.com/blog/1845-psd-viewing-diffing
[*이미지 diff에 대해 더 읽어 보세요.*](https://help.github.com/articles/rendering-and-diffing-images)
### Hub
2014-04-17 08:40:05 +09:00
[Hub](https://github.com/github/hub)는 깃허브를 좀 더 쉽게 사용할 수 있도록 추가 기능 및 명령을 제공하는 커맨드 라인 깃 래퍼입니다.
2014-04-15 16:23:45 +09:00
이렇게 할 수 있습니다.
```bash
$ hub clone tiimgreen/toc
2014-04-14 18:57:03 +09:00
```
2014-04-15 16:23:45 +09:00
[*Hub가 제공하는 더 멋진 기능들을 확인해 보세요.*](https://github.com/github/hub#commands)
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
### Contributing Guidelines
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
저장소의 제일 위에 `CONTRIBUTING` 파일을 넣어두면 기여자가 이슈를 만들거나 풀 리퀘스트를 만들 때 링크로 보여줍니다.
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
![Contributing Guidelines](https://camo.githubusercontent.com/71995d6b0e620a9ef1ded00a04498241c69dd1bf/68747470733a2f2f6769746875622d696d616765732e73332e616d617a6f6e6177732e636f6d2f736b697463682f6973737565732d32303132303931332d3136323533392e6a7067)
[*기여하기에 대해 더 읽어 보세요.*](https://github.com/blog/1184-contributing-guidelines)
2014-08-31 12:21:23 +09:00
### Octicons
깃허브 아이콘(옥티콘)이 이제 오픈소스가 되었습니다.
![Octicons](https://og.github.com/octicons/octicons@1200x630.png)
[*깃 허브의 옥티콘에 대해 더 읽어보세요.*](https://octicons.github.com)
2014-04-17 08:40:05 +09:00
### GitHub Resources
| Title | Link |
| ----- | ---- |
| GitHub Explore | https://github.com/explore |
| GitHub Blog | https://github.com/blog |
| GitHub Help | https://help.github.com/ |
2014-08-31 12:21:23 +09:00
| GitHub Training | https://training.github.com/ |
2014-04-17 08:40:05 +09:00
| 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 |
2014-04-15 16:23:45 +09:00
## Git
### Previous Branch
커맨드 라인에서 이전 디렉터리로 이동하려면 이렇게 합니다.
```bash
$ cd -
2014-04-14 18:57:03 +09:00
```
2014-04-15 16:23:45 +09:00
비슷하게, 깃에서 마지막 브랜치로 돌아가는 건 이렇게 할 수 있습니다.
```bash
$ git checkout -
# Switched to branch 'master'
$ git checkout -
# Switched to branch 'next'
$ git checkout -
# Switched to branch 'master'
2014-04-14 18:57:03 +09:00
```
2014-04-15 16:23:45 +09:00
[*깃 브랜치에 대해 더 읽어 보세요.*](http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging)
2014-04-14 18:57:03 +09:00
2014-04-17 08:40:05 +09:00
### Stripspace
깃 Stripspace는 이런 일을 합니다.
- 줄 끝의 공백을 제거
- 빈줄을 줄임
- 파일 끝에 빈 줄을 추가
커맨드를 실행 할 때 파일을 반드시 이런식으로 넘겨줘야 합니다.
```bash
$ git stripspace < README.md
```
[*깃 `stripspace` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-stripspace)
2014-04-15 16:23:45 +09:00
### Checking out Pull Requests
2014-04-14 18:57:03 +09:00
풀 리퀘스트는 깃허브 저장소에서 사용하는 특별한 브랜치로 여러 방법으로 로컬로
가져 올수 있습니다.
2014-04-14 18:57:03 +09:00
빠르게 `diff``merge`를 하기위해 특정 풀 리퀘스트를 임시로 `FETCH_HEAD`
가져오려면 이렇게 합니다.
2014-04-14 23:22:47 +09:00
2014-04-15 16:23:45 +09:00
```bash
$ git fetch origin refs/pull/[PR-Number]/head
2014-04-15 16:23:45 +09:00
```
2014-04-14 18:57:03 +09:00
모든 풀 리퀘스트 브랜치를 refspec에 의한 로컬 리모트 브랜치로 받을 수도
있습니다.
2014-04-15 16:23:45 +09:00
```bash
$ git fetch origin '+refs/pull/*/head:refs/remotes/origin/pr/*'
```
밑의 줄들을 저장소의 `.git/config`에 추가하여, 리모트의 풀 리퀘스트를 자동으로
가져오게도 할 수 있습니다.
2014-04-15 16:23:45 +09:00
```
[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`
로컬 브랜치를 만드는 것은 유용합니다.
```bash
$ git checkout pr/42 pr-42
```
2014-08-31 12:21:23 +09:00
여러 저장소를 다루어야 한다면, 전역 깃 설정에서 풀 리퀘스트를 받을(fetching) 수 있도록 설정 할 수 도 있습니다.
```bash
git config --global --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pr/*"
```
이렇게 하면 모든 저장소에서 짧은 명령어를 사용 할 수 있습니다.
```bash
git fetch origin
```
```bash
git checkout pr/42
```
2014-04-15 16:23:45 +09:00
[*풀 리퀘스트를 로컬로 체크아웃 하는 방법에 대해 더 읽어 보세요.*](https://help.github.com/articles/checking-out-pull-requests-locally)
### Empty Commits :trollface:
`--allow-empty`를 추가하시면 코드의 변경 없이 커밋을 넣을 수 있습니다.
```bash
$ git commit -m "Big-ass commit" --allow-empty
```
있을 법한 사용법에는 이런 것들이 있습니다.
- 한 뭉치의 일을 시작하기 전에 주석으로 사용
- 코드와 관련없는 프로젝트 수정을 할때 주석으로 사용
- 저장소를 사용하는 사람과의 대화
2014-04-24 10:40:07 +09:00
- 나중에 리베이스하지 않을 저장소의 첫 커밋으로 사용 `git commit -m "init repo" --allow-empty`.
2014-04-15 16:23:45 +09:00
2014-08-31 12:21:23 +09:00
![It ain't even that trolololol...](http://i.minus.com/il1jaw.gif)
2014-04-15 16:23:45 +09:00
### Styled Git Status
2014-04-14 18:57:03 +09:00
```bash
$ git status
```
2015-01-20 14:58:16 +09:00
![git status](http://i.imgur.com/qjPyvXb.png)
2014-04-14 18:57:03 +09:00
이렇게 바뀝니다.
```bash
$ git status -sb
```
2015-01-20 14:58:16 +09:00
![git status -sb](http://i.imgur.com/K0OY3nm.png)
2014-04-14 18:57:03 +09:00
2014-04-14 23:22:47 +09:00
[*깃 `status` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-status)
2014-04-15 16:23:45 +09:00
### Styled Git Log
2014-04-14 18:57:03 +09:00
2014-04-29 23:44:19 +09:00
이 명령을 실행하면
2014-04-14 18:57:03 +09:00
```bash
2014-04-29 23:44:19 +09:00
$ 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
2014-04-14 18:57:03 +09:00
```
2014-04-29 23:44:19 +09:00
이렇게 보입니다.
2015-01-20 14:58:16 +09:00
![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](http://i.imgur.com/58eOtkW.png)
2014-04-18 09:09:24 +09:00
[Palesz](http://stackoverflow.com/users/88355/palesz)님 고맙습니다.
2014-04-14 18:57:03 +09:00
NOTE: 이 명령을 알리아스 (단축 명령)으로 넣을 수 있습니다. [여기](#aliases)의 소개를 보세요.
2014-04-14 23:22:47 +09:00
[*깃 `log` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-log)
2014-04-15 16:23:45 +09:00
### Git Query
2014-04-14 18:57:03 +09:00
깃 쿼리는 모든 이전 커밋 메시지에서 검색해 가장 최근의 쿼리에 맞는 커밋을 찾아줍니다.
```bash
$ git show :/query
```
2014-04-20 16:26:10 +09:00
`query`에는 검색하고 싶은 말을 (대소문자를 구분해) 넣으세요. 주어진 검색어가 있는 가장 마지막 커밋을 표시하고 변경된 라인을 보여줍니다.
2014-04-14 18:57:03 +09:00
```bash
$ git show :/typo
```
2014-04-14 23:22:47 +09:00
![git show :/query](http://i.imgur.com/icaGiNt.png)
2014-04-14 18:57:03 +09:00
NOTE: 나오려면 `q`를 누르세요.
2014-04-15 16:23:45 +09:00
### Merged Branches
2014-04-14 18:57:03 +09:00
```bash
$ git branch --merged
```
이 명령어는 현재 브랜치에 머지된 모든 브랜치의 목록을 보여줍니다.
거꾸로
```bash
$ git branch --no-merged
```
이 명령어는 현재 브랜치에 머지되지 않은 브랜치의 목록을 보여줍니다.
2014-04-14 23:22:47 +09:00
[*깃 `branch` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-branch)
2014-07-06 16:54:56 +09:00
### Fixup and Autosquash
이전(HEAD의 한개 이상 전의) 커밋에 잘못된 부분이 있다면, 예를들어 `abcde`라면,
문제를 수정하고 밑의 커맨드를 입력해 고칠 수 있습니다.
```bash
$ git commit --fixup=abcde
$ git rebase abcde^ --autosquash -i
```
[*깃 `commit` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-commit)
[*깃 `rebase` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-rebase)
2014-04-15 16:23:45 +09:00
### Web Server for Browsing Local Repositories
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
`instaweb` 커맨드을 사용하면, 즉석에서 `gitweb`안에서 작업중인 저장소를 둘러 볼
수 있습니다. 이 커맨드는 `gitweb`과 로컬 저장소를 브라우징 하기 위한 웹 서버를 설정하는 스크립트입니다.
2014-04-14 18:57:03 +09:00
2014-04-15 16:23:45 +09:00
```bash
$ git instaweb
2014-04-14 18:57:03 +09:00
```
2014-04-15 16:23:45 +09:00
Opens:
2014-04-14 23:22:47 +09:00
2014-04-15 16:23:45 +09:00
![Git instaweb](http://i.imgur.com/Dxekmqc.png)
2014-04-14 23:22:47 +09:00
2014-04-15 16:23:45 +09:00
[*깃 `instaweb` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-instaweb)
2014-04-14 23:22:47 +09:00
2014-04-15 16:23:45 +09:00
### Git Configurations
2014-04-14 18:57:03 +09:00
`.gitconfig`는 모든 설정이 들어있는 파일입니다.
2014-04-15 16:23:45 +09:00
#### Aliases
2014-04-14 18:57:03 +09:00
알리아스는 커스텀 깃 명령어를 등록할 수 있는 핼퍼입니다. 예를 들어 `git a``git add --all`를 실행하게 할 수 있습니다.
알리아스를 추가하려면 `~/.gitconfig`를 찾아 다음 포멧으로 입력하거나
```
[alias]
co = checkout
cm = commit
p = push
2014-04-14 23:22:47 +09:00
# Show verbose output about tags, branches or remotes
tags = tag -l
branches = branch -a
remotes = remote -v
2014-04-14 18:57:03 +09:00
```
커맨드 라인에서 다음 명령을 입력합니다.
```bash
2014-04-19 11:14:26 +09:00
$ git config --global alias.new_alias git_function
2014-04-14 18:57:03 +09:00
```
예를들면
```bash
2014-04-19 11:14:26 +09:00
$ git config --global alias.cm commit
2014-04-14 18:57:03 +09:00
```
NOTE: 여러 함수를 알리아스하려면 따옴표를 이용하세요.
```bash
2014-04-19 11:14:26 +09:00
$ git config --global alias.ac 'add -A . && commit'
2014-04-14 18:57:03 +09:00
```
여기 몇 가지 권장 알리아스가 있습니다.
| 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'` |
2014-04-14 23:22:47 +09:00
| `git tags` | `git tag -l` | `git config --global alias.tags 'tag -l'` |
| `git branches` | `git branch -a` | `git config --global alias.branches 'branch -a'` |
2015-01-01 12:47:52 +09:00
| `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"` |
2014-04-14 23:22:47 +09:00
| `git remotes` | `git remote -v` | `git config --global alias.remotes 'remote -v'` |
2014-05-08 09:18:48 +08:00
| `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 --"` |
2014-04-14 18:57:03 +09:00
*일부 알리아스는 [@mathiasbynens](https://github.com/mathiasbynens)님의 dotfiles에서 가져왔습니다.(https://github.com/mathiasbynens/dotfiles/blob/master/.gitconfig)*
2014-04-15 16:23:45 +09:00
#### Auto-correct
2014-04-14 18:57:03 +09:00
현재 `git comit`를 치면 이런 결과를 보실 수 있습니다.
```bash
$ git comit -m "Message"
# git: 'comit' is not a git command. See 'git --help'.
# Did you mean this?
# commit
```
`comit`을 쳤을 때 `commit`을 부르려면, 자동 교정을 켜두세요.
```bash
$ git config --global help.autocorrect 1
```
이제 이런 결과를 보실 수 있습니다.
```bash
$ 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...
```
2014-04-15 16:23:45 +09:00
#### Color
2014-04-14 18:57:03 +09:00
깃 커맨드 라인에 색을 넣으려면 이렇게 하세요.
```bash
$ git config --global color.ui 1
```
2014-04-14 23:22:47 +09:00
[*깃 `config` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-config)
2014-04-17 08:40:05 +09:00
### 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 |
2014-08-31 12:21:23 +09:00
| Git for Designers | http://hoth.entp.com/output/git_for_designers.html |
2014-04-17 08:40:05 +09:00
| Git for Computer Scientists | http://eagain.net/articles/git-for-computer-scientists/ |
| Git Magic | http://www-cs-students.stanford.edu/~blynn/gitmagic/ |
2014-04-29 23:44:19 +09:00
| GitHub Training Kit | http://training.github.com/kit |
2014-04-17 08:40:05 +09:00
#### 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 |
2014-08-31 12:21:23 +09:00
| Git Internals PluralSight | https://github.com/pluralsight/git-internals-pdf |
2014-04-17 08:40:05 +09:00
| 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 |