2. git init
git init
저장소 초기화
git init <directory>
디렉토리 생성과 동시에 저장소 초기화
git init --bare my-project.git
서버에 git 설치 시 쓰임
3. git clone
git clone <repo-url>
저장소 복사하기
git clone <repo-url> <directory>
폴더 생성 후 저장소 복사하기
4. git config
git config user.name | user.email <name|email>
<repo>/.git/config 에 저장
git config --global user.name | user.email <name|email>
~/.gitconfig 에 저장.
[alias]
st = status
co = checkout
br = branch
up = rebase
ci = commit
[core]
editor = vim
그 밖에,
!
alias.st <git command>
core.editor <editor>
5. git add
git add <file>
파일 단위 추가
git add <directory>
폴더 단위 추가
working directory -> staging snapshot
6. git commit
git commit
git config에 지정된 editor 실행 후 커밋로그 작성.
git commit -m <message>
변경된 파일들(!Unstaged)을 확정하고 커밋로그 작성.
16. Rewriting Git History
git commit --amend
최신 커밋로그 메세지 수정
git rebase -i
불특정 다수의 변경내역을 한개로 병합.
git reflog
지금까지 작업했던 목록들을 확인.
리셋하기전에 많이 사용.
17. git remote - 1
git remote
현재 리모트 저장소 상태 확인. "origin"
git remote -v
리모트 저장소 목록 확인.
목록을 통해서 다른 사람이 기여한 내용을 쉽게 확인 가능.
git remote add <name> <url>
리모트 저장소 추가.
<url>을 저장소를 <name>으로 지정하면, 리모트 저장소에 목록에 저장.