위로 아래

초반 세팅

git-scm.com에서 git 다운로드

 

Git bash 이용

 

유저 이름 설정

git config --global user.name "gaesol2"

 

유저 이메일 설정

git config --global user.email "gaesol@tistory.com"

 

정보 확인하기

git config --list

 

 

 


코드 업로드

이클립스 window에서 Terminal 창 선택

git bash Terminal 열기

 

초기설정

git init

처음 한 번만 하면 된다. 현재 경로를 git local 저장소로 지정한다.

 

초기 설정 해제

rm -r .git

.git 폴더와 파일을 삭제하고 git local 저장소를 취소한다.

 

 

파일 추가하기 

git add 파일명.확장자

 

파일 전체 추가하기

git add .

 

상태 확인

git status

 

히스토리 만들기

git commit -m "first commit"

-m : mesage

first commit : 히스토리 이름. 바꿔도 된다.

 

로컬 프로젝트를  GitHub repository에 연결하기

git remote add origin https://github.com/gaesol2Github/practice.git

 

연결 확인

git remote -v

 

GitHub에 업로드

git push origin branchname

 

 

 

 


Git 협업하기

GitHub에서 소스코드 다운로드

git clone 깃허브주소

 

GitHub에 개인 브랜치 만들기

git checkout -b 브렌치이름

 

개인 브랜치에 소스코드 업데이트

git add .
git commit -m "first commit"
git push origin 브렌치이름

 

마스터 브랜치에서 소스 가져오기

git pull origin master

 

다른 브랜치로 이동

git checkout 브랜치이름