본문 바로가기

git

git checkout 갱신

728x90

refactoring 브랜치로 체크아웃 해서 작업하려고 git checkout refactoring 명령어를 입력하니, 다음과 같은 에러메세지를 마주했다.

error: pathspec 'refactoring' did not match any file(s) known to git

해당 에러는 로컬 저장소의 git과 리모트 저장소의 git 정보가 동기화 되지 않아서, 새로 만들어진 리모트 저장소 브랜치를 참조할 수 없기에 발생하는 에러다.

 

그러므로 아래 명령어로 원격 브랜치를 업데이트 한 뒤 checkout을 실행하면 잘 동작한다!

 

git remote update
git checkout 브랜치명

 

git remote update : 모든 원격 브랜치를 업데이트하여 최신 상태로 갱신한다. 하지만 로컬 저장소에서 변동사항을 병합(merge)하지 않는다.

 

참고 : https://stackoverflow.com/questions/5989592/git-cannot-checkout-branch-error-pathspec-did-not-match-any-files-kn

 

Git: cannot checkout branch - error: pathspec '...' did not match any file(s) known to git

I'm not sure why I'm unable to checkout a branch that I had worked on earlier. See the commands below (note: co is an alias for checkout): ramon@ramon-desktop:~/source/unstilted$ git branch -a * d...

stackoverflow.com

 

git 의 working flow

 

 

git init

git add .

git commit -m 'message'

git remote -v

git remote add origin 주소

git remote -v

처음푸쉬할 시 
git push --set-upstream origin master 

728x90