상세 컨텐츠

본문 제목

Git | 프로젝트를 여럿이서

카테고리 없음

by AI Engineer crystal 2024. 10. 22. 10:04

본문

branch를 여러개 만든 프로젝트를 여럿이서 사용하고자 할 때 vscode에서 terminal에 ```git fetch```를 입력하면 다음과 같이 모든 branch를 포함한 깃의 내용을 vscode로 연결할 수 있습니다.

.venv(base) iMac@iMac project % git fetch
remote: Enumerating objects: 43, done.
remote: Counting objects: 100% (43/43), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 35 (delta 20), reused 28 (delta 13), pack-reused 0 (from 0)
Unpacking objects: 100% (35/35), 6.64 KiB | 399.00 KiB/s, done.
From https://github.com/crystal397/example
   f9b8107..2a2740e  dev_api_refact -> origin/dev_api
 * [new branch]      dev_db_schema  -> origin/dev_db_schema
 * [new branch]      dev_xlsx_to_db -> origin/dev_xlsx_to_db


그리고나서 원하는 branch로 들어가기 위해 ```git checkout origin/[원하는 branch명]``` 입력하면 다음과 같은 코드를 볼 수 있습니다.

.venv(base) iMac@iMac project % git checkout origin/dev_api
Note: switching to 'origin/dev_api'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 2a2740e modify: timeout error fix

 

그렇지만 여기서 바로 수정하면 git과 연동이 되기 때문에 test용으로 새로 만드는 작업을 합니다.

.venv(base) iMac@iMac project % git checkout -b test
Switched to a new branch 'test'