신기하면서 어려운 Git...
Git 설치하기
Mac os에서는 터미널에 "git" 이라고 입력하면 설치 할 수 있다.
Git 환경 설정
$ git config --global user.name "내 이름" : 이름 설정
$ git config --global user.email "내 이메일" : 이메일 설정
--global 옵션을 사용하면 기본 설정된다.
Git
혼자 작업 workflow
Fork : github 에 있는 Repository를 내 Repository로 복사한다.
clone : git clone "Repository 주소", 내 컴퓨터 (local Repository)로 복사한다.
git status : 내 컴퓨터에 있는 파일들의 상태를 확인한다. untracked files와 staging area 로 나뉜다.
add : git add "파일명" or git add . , commit 할 수 있는 상태로 만든다.
restore : git restore "파일명", 변경사항을 폐기한다.
commit : git commit -m "메시지", 메시지와 함께 커밋한다.
reset : git reset HEAD^, Local Repository에만 commit 해 놓은 기록을 취소한다.
push : git push origin master, commit 기록을 내 Remote Repository 에 업로드한다.
log : git log, 현재까지 commit 된 로그를 볼 수 있다.
Pull Request : 줄여서 PR, 함께 작업하는 사람들에게 알리는 것.
함께 작업 workflow
init : git init, 내 컴퓨터의 디렉토리를 Git Repository로 변환한다.
git remote add origin "Repository 주소" : Remote Repository와 연결한다.
git remote add "상대방의 Repository 이름" "Repository 주소" : 협업하는 상대의 Repository와 연결한다.
git remote -v : 연결된 모든 Remote Repository 목록을 확인한다.
git pull "name" "branch" : 상대방의 Remote Repository에 있는 작업 내용을 받을 수 있다. 이 때, 받은 내용은 자동으로 병합된다.