category
Github
2022. 4. 29. 16:40
by 소프트웨어종사자
- 특정 branch만 pull하는 명령어
- branch 확인 명령어
- 두 branch 비교 명령어
- $> git diff origin/master origin/dev
- master , dev branch 비교
- branch merge 리셋 명령어
- 에러 : you need to resolve your current index first
- $> git reset --merge
- branch 변경 명령어
- $> git checkout dev
- dev branch로 변경
- 디렉토리의 파일을 임시로 백업하고 깨끗한 상태로 돌리는 명령어
- pull 명령어 때 에러 발생
- 에러
- Your local changes to the the following files would be overwritten by merge
- please clean your repository working tree before checkout
- $> git stash
- branch remote 저장 명령어
- $> git push origin <branch 이름>
- branch 삭제 옵션별 명령어
- -d
- $> git branch -d <branch 이름>
- -D
- 에러
- The branch '<branch 이름>' is not fully merged
- 원인
- master 에 분기되지 않은 branch 라서 발생
- $> git branch -D <branch 이름>
- 로컬 branch 삭제한 것을 원격에 반영
- $> git push -d origin <branch 이름>
- 로컬 branch 삭제한 것을 원격 반영 시 에러
- 에러
- remote ref does not exist
- 원인
- 삭제한 branch가 남아 있는 경우
- $> git fetch --all --prune
- $> git fetch -all prune
- branch 확인 명령어
- git commit 취소 명령어
- git stash 조회
- git stash 취소
- $> git stash show -p stash@{1} | git apply -r
- ('stash@{1}' 은 git stash list로 조회한 stash id)
- git stash 되돌리기 (가져오기)
- git pull 취소
- $> git reset --hard ORIG_HEAD
- git commit 취소
- $> git reset --soft HEAD^
- More? 이라고 물어보면 아래 명령어로 실행
- $> git reset --soft HEAD~1
- git branch 삭제
- 로컬 : git branch -d dev
- 원격 : git push origin --delete dev