4일차(Git hub 사용법)

Rina's·2023년 4월 14일

코드스테이츠

목록 보기
4/96

Git hub

workflow

solo
work space -> staging -> commit(local) -> remote

pair
받음 시작 : clone -> pair remote -> pull, push를 하여 수정후 merge
줌 시작 : solo flow 후 pair remote

Work space 생성

  1. mkdir
  2. git init(디렉토리를 git관리 적용)

remote와 local repository 연결

  1. git hub에서 repository 생성하여 SSH확인
    or git hub에서 Fork후 SSH확인
  2. git clone [SSH주소] (복사)
  3. git remote add [별칭] (연결)
  4. git remote -v (연결 확인)

* 설정된 연결 끊기 git remote remove [별칭]
* fork clone할 경우 자동으로 git init와 remote가 설정된다
페어와 공유시 연결된 주소와 브랜치를 알려주도록 하자

본인(origin-올릴곳)과 상대방(test-받을곳)의 별칭을 구분해서 기억하자

수정할 파일 Work space로 받기

  1. git pull test [별칭][브랜치]
  2. git status (변경내용 확인)

수정 nano 등..

Staging area(staging)

  1. git 파일명
    또는 git add . (다보내기)
  2. git status (확인)

remote repository(track 상태로 바꾸기)로 보내기

  1. git commit -m "" (local repository 저장, 메세지를 통한 버전입력)
    *** 마지막으로 보낸 커밋 취소 명령어 git reset HEAD~1
  2. git log (확인) ** log 나가는키 'q'
  3. git push test [별칭]브랜치

같은 부분을 동시에 수정해 push할시 충돌로 나오는 문구
Automatic merge failed; fix conflicts and then commit the result

** 새로운 브랜치 생성하고 해당 브랜치로 이동하기
git checkout -b <브랜치명>

profile
갭린이 리나

0개의 댓글