git

항해99 36일차-Git명령어 정리(협업)

jann2 2021. 12. 6. 23:27

 

 

 

 

1. Github에서 소스코드 다운로드

(git clone -b jawoon --single-branch  repo url : 한개의 branch만 클론)

git clone 주소 폴더이름(url 복사해오기)

2. branch만들기

git checkout -b 만들branch이름

-jawoon 이라는 이름의 branch 생성

-checkout하면 생성하면서 branch도 같이 옮겨준다.

 

3.커밋하기

git add .

-> 변경사항을 모두 더해준다.(.이라고 하면 모든 변경사항 가져오는 것)

git commit -m "first commit"

-> ""사이에는 넣어주고 싶은 commit이름을 넣어주면 된다.

git push -u origin 브랜치이름

 

4. 상태 확인

git status

-> add된 내역 확인

git remote -v

-> 설정되어 있는 원격저장소 주소

git branch -a

-> branch위치 확인

 

5. remote repo 설정

git remote add origin 주소폴더이름(url)

 

6. git remote rm origin

->remote repo 삭제

 

7. 메인에서 받아오기

  git pull origin-repo main

이렇게 뜰 경우에는 push를 먼저 한번 하고 그 다음에 pull