•
기존에 존재하는 로컬 저장소를 원격 저장소와 연결하고 싶을 땐, 아래 스텝을 따르자.
1.
로컬에 프로젝트 생성
2.
git init → 로컬 저장소 생성
3.
git branch -M main → 현재 브랜치 이름을 master에서 main으로 변경
4.
5.
git commit -m “add: init” → 커밋 날리기
6.
7.
git push -u origin main → 푸시하기
•
커밋하고 푸쉬하기
git add .
git commit -m '커밋메시지'
git push origin ChooSeoyeon
Java
복사
•
풀 받기
참고
•
폴더명 바꾸기: git bash rename directory
git mv '현재폴더명' '바뀔폴더명'
git add .
git commit -m "Style: rename directory"
git push origin master
JavaScript
복사
결과
참고 사이트
•
현재 변경사항을 다른 브랜치에 커밋하기
git stash
git checkout other-branch
git stash pop
C++
복사
◦
git stash는 커밋하지 않은 변경사항을 임시로 저장한다.
◦
git checkout 명령어로 브랜치를 옮긴 뒤
◦
git stash pop 명령어로 앞서 저장한 내용을 가져온다.
◦
git stash drop
▪
가장 최근에 만든 stash 삭제
◦
git stash drop stash@{0}
▪
특정 stash id 삭제(git stash list 치면 나오는 id)
◦
git stash clear
▪
모든 stash를 삭제
•
브랜치 생성 및 이동
git checkout -b branchname
•
원격 저장소의 branch 가져오기
git fetch origin 하고서 확인하기 → git branch -a
혹은
git checkout -t origin/develop
◦
위 방법이 있지만, 그냥 로컬에 브랜치 생성하고, pull 받는 걸 추천
$ git checkout -b develop
Switched to a new branch 'develop'
$ git pull origin develop
From https://github.com/NoiLab/NoiLab-Backend
* branch develop -> FETCH_HEAD
* [new branch] develop -> origin/develop
Already up to date.
JavaScript
복사