git 연결하기
파일을 생성하고 생성한 파일로 진입 후 명령어 git init실행
git init
1-1. 파일을 내 Remote Repository와 연결해서 Remote 상에도 이 코드를 적용해 origin이라는 이름으로 내 Remote Repository등록 (내 깃헙 리파지토리 생성후 주소복사)
git remote add origin 내리퍼지토리주소
1-2. 잘 등록 되었나 확인 하기
git remote -v
페어와 함께 작업을 할때 main브랜치에 커밋한 기록을 origin reomte repository에 올려서 코드 공유
git commit origin main
페어가 내 Remote Repository에 Fork 하고 나면 페어의 Remote Repository를 내 Local에 pair 라는 이름으로 등록(이름은 변경해도 상관없음)
git remote add pair 페어의리파지토리 주소
잘 등록 되었나 확인 한번 해주고!
git remote -v
개별 작업후 내 commit을 push하기 전에 페어가 작업해서 본인 Remote Repository에 올려놓은 내용 합치려고 페어의 코드를 내 Local로 받아올때
git pull pair main
(git pull pair master 일수도 있다)
특정 commit 시점으로 각기 다른 commit을 만들면, 기본적으로 자동으로 merge가 된다 내 Remote Repositoty에도 Local내용 반영
git push origin main
또는 git push origin master
some.html파일을 수정했다 작업사항을 커밋하기위해 마찬가지로
git add some.html 하고나서
git commit -m 'some.html 수정'
페어도 some.html에 변경사항 있다고 했을때 내 커밋을 Remote에 푸시하기 전에 페어의 코드를 내컴퓨터로 받아올때
git pull pair main 또는
git puu pair master
만약 동일한 라인을 수정해서 파일의 충돌이 날경우 한쪽에서 충돌 처리 한후 add > commit 해주면 된다
(충돌로 인해 add한경우 commit 명은 따로 쓰지 않아도 됨)
git add some.html
git commit
merme commit이 자동으로 생성되고 이제 내 Remote Repository에도 Local Repository의 내용을 반영한다
git push origin main 또는
git push origin master
git remote remove origin
git remote remove pair