190813 bridge-course Git — 기본command
git command
git init
현재 로컬 디렉토리를 git repository로 설정.
git log
HEAD(commit branch)와 커밋 기록 확인 가능
git log — — graph — — decorate (git log에 시각적 옵션을 추가)
git log —p (파일의 내용 및 변화사항 디테일하게 확인 가능)
git status
로컬 깃 repo의 상황을 확인 가능.
git diff
modifed 상세 변화를 확인 가능. q로 나올 수 있음.
git add
변화한 사항을 modify.
git add file01
git add * / git add . -> pwd 모든 변화 파일 저장
git commit
git commit -m ‘message’ / or git commit 후 에디터로 이동해서 message작성
git branch
현재 작업중인 branch명 확인 가능.
git checkout -b
checkout은 branch이동, -b는 branch 생성.
git checkout -b robot/login : ‘robot/login’라는 branch를 생성하고 이동.
git merge ‘branchname’
master에서 특정 branch의 commit사항을 현재 head에 merge.
git rebase master
기타 branch를 최신 마스터 커밋으로 rebase.
- conflict issue 발생 가능성 존재.
git reset HEAD~1 ( git reset — — hard HEAD~1)
현재파일은 그대로, 그러나 git commit을 이전 단계로 변경.
— — hard 옵션을 줄 경우 실제 파일도 커밋과 함께 reset.
git remote add origin https:github.com/something
git remote add upstream https://github.com/exup
git remote -v 를 통해 현재 git remote확인 가능.
git push origin master
commit사항을 push. origin remote에 있는 master branch로 올림
git push -u origin newBranch ( -u옵션을 통해 해당 branch없는 경우 생성도 가능)
git config — — list
현재 내 정보를 확인 가능.