-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
Description
개요
git worktree를 이용하여 브랜치에 대한 공간을 나눠 작업을 할 수 있도록 구성하려고 함.
Workflow
구조
project1 branch: {default_branch}
├── README.md
└── workspace
├── feature
│ ├── feature-1 branch: feature/feature-1
│ └── feature-2 branch: feature/feature-2
└── hotfix
└── fix-1 branch: hotfix/fix-1
시작
git worktree -b <branch_name> ./workspace/<worktree_path>로 브랜치 생성과 worktree 생성을 동시에 진행worktree_path는branch_name으로 구성- 중간에 빈칸은
-로 쓸까?_로 쓸까...?-로 쓰고 path에서는_로 변환. 하는게 나을수 있음.
- 중간에 빈칸은
branch_name이[feature|hotfix]/<branch_name>으로 생성될 경우,worktree_path도[feature/hotfix]/<worktree_path>로 보일 수 있도록 구성./workspace아래에 생성되는 것에 대해서 root path에서 인지하지 못하도록 설정.gitignore처리시 worktree 내부에서 보여지는지 확인 필요.
작업
./worktree/<worktree_path>로 이동하여 작업.
끝
- 브랜치가 머지된 상태.
- root path 에서 명령어가 실행되어야함.
git branch -D <branch_name> && git worktree remove ./workspace/<worktree_path>가 실행되어 완료된 항목에 대해서 제거를 진행.
참고
- git-scm/git-worktree
- git-worktree-manager
- VSCode에서 worktree 생성시 VSCode workspace를 새롭게 띄워줌.
- git gone alias
- git 단축 명령어이며, 해당 작업을 하게되면 머지된 브랜치를 로컬에서 삭제하게됨.