- Arabic Git Cheat Sheet
- Chinese Git Cheat Sheet
- Hindi Git Cheat Sheet
- Turkish Git Cheat Sheet
- Spanish Git Cheat Sheet
- Greek Git Cheat Sheet
- Korean Git Cheat Sheet
깃 치트시트는 당신이 모든 명령어를 외우는 일로부터 벗어나게 해드립니다.
언제든지 기여하고 문법 실수들을 업데이트하세요. 또한 언어 파일을 자유롭게 추가할 수 있습니다.
$ git config --list
$ git config --local --list
$ git config --global --list
$ git config --system --list
$ git config --global user.name “[firstname lastname]”
$ git config --global user.email “[valid-email]”
$ git config --global color.ui auto
$ git config --global core.editor vi
<repo>/.git/config
~/.gitconfig
/etc/gitconfig
2가지 방법이 있습니다:
SSH를 통해
$ git clone ssh://[email protected]/repo.git
HTTP를 통해
$ git clone http://domain.com/user/repo.git
$ git init
$ git init <directory>
$ git status
$ git diff
$ git diff <file>
$ git add .
$ git add -p <file>
$ git commit -a
$ git commit
$ git commit -m 'message here'
$ git commit -am 'message here'
$ git commit --date="`date --date='n day ago'`" -am "<Commit Message Here>"
이미 배포된 커밋을 수정하지 마세요!
$ git commit -a --amend
이미 배포된 커밋을 수정하지 마세요!
$ git commit --amend --no-edit
GIT_COMMITTER_DATE="date" git commit --amend
$ git commit --amend --date="date"
$ git stash
$ git checkout branch2
$ git stash pop
$ git stash apply
git stash list
를 통해 {stash_number} 를 얻을 수 있습니다.
$ git stash apply stash@{stash_number}
$ git stash drop
$ git grep "Hello"
$ git grep "Hello" v2.5
$ git log
$ git log --oneline
$ git log --author="username"
$ git log -p <file>
$ git log --oneline <origin/master>..<remote/master> --left-right
$ git blame <file>
$ git reflog show
$ git reflog delete
Index.txt에서 Index.html로 이름 바꾸기
$ git mv Index.txt Index.html
$ git branch
$ git branch -a
$ git branch -r
$ git checkout <branch>
$ git checkout <branch> -- <filename>
$ git checkout -b <branch>
$ git checkout -b <new_branch> <existing_branch>
$ git checkout <commit-hash> -b <new_branch_name>
$ git branch <new-branch>
$ git branch --track <new-branch> <remote-branch>
$ git branch -d <branch>
$ git branch -m <new_branch_name>
머지되지 않은 변경사항을 잃게 됩니다!
$ git branch -D <branch>
$ git tag <tag-name>
$ git tag -a <tag-name>
$ git tag <tag-name> -am 'message here'
$ git tag
$ git tag -n
$ git remote -v
$ git remote show <remote>
$ git remote add <remote> <url>
$ git remote rename <remote> <new_remote>
$ git remote rm <remote>
알림: git remote rm 은 서버의 원격 리포지토리를 삭제하지 않습니다. 단순히 리모트와 참조를 로컬 리포지토리에서부터 삭제만 합니다.
$ git fetch <remote>
$ git remote pull <remote> <url>
$ git pull origin master
$ git pull --rebase <remote> <branch>
$ git push remote <remote> <branch>
$ git push <remote> :<branch> (since Git v1.5.0)
혹은
$ git push <remote> --delete <branch> (since Git v1.7.0)
$ git push --tags
$ git config --global merge.tool meld
$ git mergetool
$ git merge <branch>
Don't rebase published commit!
$ git rebase <branch>
$ git rebase --abort
$ git rebase --continue
$ git add <resolved-file>
$ git rm <resolved-file>
$ git rebase -i <commit-just-before-first>
이제 이걸
pick <commit_id>
pick <commit_id2>
pick <commit_id3>
이렇게 바꿉니다,
pick <commit_id>
squash <commit_id2>
squash <commit_id3>
$ git reset --hard HEAD
$ git reset HEAD
$ git checkout HEAD <file>
$ git revert <commit>
$ git reset --hard <commit>
$ git reset --hard <remote/branch> e.g., upstream/master, origin/my-feature
$ git reset <commit>
$ git reset --keep <commit>
$ git rm -r --cached .
$ git add .
$ git commit -m "remove xyz file"
Improved Git-flow
$ brew install git-flow-avh
$ port install git-flow
$ sudo apt-get install git-flow
$ wget -q -O - --no-check-certificate https://raw.githubusercontent.com/petervanderdoes/gitflow/develop/contrib/gitflow-installer.sh install <state> | bash
Git flow needs to be initialized in order to customize your project setup. Start using git-flow by initializing it inside an existing git repository:
You'll have to answer a few questions regarding the naming conventions for your branches. It's recommended to use the default values.
git flow init
OR
git flow init -d
git flow feature start MYFEATURE
git flow feature finish MYFEATURE
Are you developing a feature in collaboration? Publish a feature to the remote server so it can be used by other users.
git flow feature publish MYFEATURE
git flow feature pull origin MYFEATURE
git flow feature track MYFEATURE
Support preparation of a new production release. Allow for minor bug fixes and preparing meta-data for a release
To start a release, use the git flow release command. It creates a release branch created from the 'develop' branch. You can optionally supply a [BASE] commit sha-1 hash to start the release from. The commit must be on the 'develop' branch.
git flow release start RELEASE [BASE]
It's wise to publish the release branch after creating it to allow release commits by other developers. Do it similar to feature publishing with the command:
git flow release publish RELEASE
git flow release finish RELEASE
Hotfixes arise from the necessity to act immediately upon an undesired state of a live production version. May be branched off from the corresponding tag on the master branch that marks the production version.
$ git flow hotfix start VERSION [BASENAME]
The version argument hereby marks the new hotfix release name. Optionally you can specify a basename to start from.
By finishing a hotfix it gets merged back into develop and master. Additionally the master merge is tagged with the hotfix version
git flow hotfix finish VERSION