[CODEcademy] Learn Git

CODEcademy Git

Git Hub에 공부내용을 올리고자 공부 시작!

git init
-> 로그인
git status
-> 현재 상태 확인
git add filename
-> 파일 추가
git diff filename
-> 수정 확인
*수정이 완료 되었으면 add를 해줘야한다.
git commit -m “message”
-> ‘git commit’은 뒤 내용을 command 한다.
-> -m 은 메시지가 따라오도록 하는 옵션이다.
git log
-> commit 기록의 date와 time, message를 보여주고, 코드는 SHA로 암호화하여 보여준다.
git show HEAD
-> git log에 더해서 변한 부분들을 보여준다.
git checkout HEAD filename
-> 수정된 부분을 버려버린다.
git add filename_1 filename_2
-> 한 줄로 여러 파일을 한번에 add 할 수 있다.
git reset HEAD filename
-> 파일을 HEAD와 같은 공간으로 재설정한다.
-> 작업한 directory에서 파일 변경사항을 삭제하지 않고 준비영역에서 제거한다.
git reset SHA
-> SHA는 git log로 확인하여 앞에 7자리만 입력한다.
-> 그 명령을 친 순간으로 돌아가는 명령어이다.
git branch
-> 자신이 사용 중인 branch를 확인
git branch new_branch
-> 새로운 branch 생성
git checkout branch_name
-> 현재 branch를 변경한다.
git merge branch_name
-> 다른 branch를 현재 branch와 합친다.
CONFLICT (content): Merge conflict in resumé.txt
Automatic merge failed; fix conflicts and then commit the result.
-> 현재 branch에서 수정한 내용과 합치려는 branch에서 수정한 내용이 겹칠때 나오는 에러
* 여기서는 resume.txt에서 겹쳤다.
git branch -d branch_name
-> branch를 삭제하는 명령어
git clone remote_location clone_name
-> remote_location에 clone_name에 복사한다.
git remote -v
-> remote를 보여주는 명령어
git fetch
-> 이렇게 하면 remote branch에 변경사항을 저장한다.
git push origin your_branch_name
-> 로컬에 romote를 푸쉬한다.