깃 사용법

Geun A·2021년 11월 13일

Git 사용법

아래 처럼 해야됨

————————————————————————————————————
첫번째. 메인(팀장) 깃에서 이슈를 생성

터미널에서
% git branch 로 위치가 어딘지 확인
Ex) git branch
main

% git checkout -b 뒤에 원하는 위치적어서 이동
Ex) git checkout -b feature-issue-#4

해당 이슈로 이동됐는지 확인
% git branch 로 위치가 이동 됐는지 확인(안됐을시 % git checkout -b 로 다시)
Ex) git branch
feature-issue-#4

————————————————————————————————————
두번째. 메인(팀장) 깃에 올릴때

% git add . 로 전체 올리고

% git commit -m ‘add: 적고싶은 메세지’ 로 메세지 적어로 올리고

% git log 로 커밋 어디다가 올라갔는지 확인 (필수 아님)
Ex) git log
commit 6f986670944708cf3f112f61b8730eb751e414b0 (HEAD -> feature-issue-#4)
Author: geunangel 1004geuna1004@gmail.com
Date: Fri Oct 29 13:21:00 2021 +0900

% git remote -v 로 주소 확인 (필수 아님)
Ex)git remote -v
origin https://github.com/geunangel/codecamp-team-3.git (fetch)
origin https://github.com/geunangel/codecamp-team-3.git (push)

% git push origin 뒤에 main이 아닌 해당 이슈 적어서 올림
Ex)git push origin feature-issue-#4
Everything up-to-date

————————————————————————————————————
세번째. 터미널에서 branch를 main으로 이동 후 issue branch 삭제

% git checkout -b 뒤에 원하는 위치적어서 이동
Ex) git checkout -b feature-issue-#4

branch 지워짐
꼭 branch가 main 에 있어야 지울 수있음
% git branch -D feature-issue-#

————————————————————————————————————
네번째. 메인(팀장)깃에서 머지 후 풀 받을때
*꼭 main에 있을 때 받아야 함

Pull 받을때는 아래처럼 해야됨(upstream)
% git pull upstream develop

% git remote -v 로 주소 확인 (필수 아님)
Ex)git remote -v
origin https://github.com/geunangel/codecamp-team-3.git (fetch)
origin https://github.com/geunangel/codecamp-team-3.git (push)

메인 깃에 처음 등록할때만 씀
% git remote add upstream 뒤에 원본주소 적어서 받아야함

————————————————————————————————————

profile
Frontend 개발입문자 코린이의 코딩이야기

0개의 댓글