[개인] GIT의 모든 것

최정윤·2022년 5월 20일
0

📌 깃 설치하기

https://git-scm.com/download/win → 여기에서 설치한다.

// commit할 때 쓰일 유저이름
git config --global user.name jypjun12

// commit할 때 쓰일 유저이메일
git config --global user.email jypjun12@gmail.com
 
git config --list
// 작업공간을 c드라이브의 gitWS로 지정해주었다.
WScd c:/git/gitWS
// 현재 디렉토리를 로컬 저장소로 설정한다.
// 로컬저장소로 설정
git init

// 로컬저장소 설정을 취소하려면
rm -r .git

// 로컬 저장소의 현재 상태를 확인해보자.
git status

https://gbsb.tistory.com/10
https://junyoeng.tistory.com/18

📌 Github에서 레파지토리 가지고 오기

  1. git에서 repository 링크 복사
  2. git bash에서 복제를 원하는 로컬 디렉토리로 이동한다.
cd c:/(원하는 디렉토리)
  1. git bash에서 로컬로 복제한다.
git clone (복사한 주소)
  1. ls를 이용하여 복제가 잘되었는지 확인한다.
ls

📌 branch생성 & 연결하기

  1. branch를 생성하고 생성된 brach로 전환한다.
git checkout -b (brach 이름)
  1. brach 생성만 하는 코드
git branch (branch 이름)
  1. branch 전환만 하는 코드
git checkout (branch 이름)

⚙️ Branch 명령어 정리

현재 자신의 파일과 연결된 branch 목록
$ git branch

branch 삭제
$ git branch -d {branch 이름}

branch 강제 삭제 : 위의 방법으로 삭제가 안될 때 사용
$ git branch -D {branch 이름}

branch에 코드push
$ git push origin {branch 이름}

A 브랜치에 B브랜치 merge하기
$ git checkout {A branch}
$ git merge {B branch}

branch 끼리 비교
$ git diff {branch 이름} {branch 이름}


git init
git remote add origin https://github.com/~.git
git pull origin 브런치이름
git checkout -b 브런치이름

git add .
git commit -m "어쩌구"
git push origin 브런치이름

https://velog.io/@roong-ra/Git-Github-%EC%82%AC%EC%9A%A9%EB%B2%95-%ED%8C%8C%EC%9D%BC%EC%82%AD%EC%A0%9C-%EC%B4%88%EA%B8%B0%ED%99%94-url-%EB%B3%80%EA%B2%BD -> github 사용법

profile
개발 기록장

0개의 댓글