티스토리 뷰
미니 프로젝트 시작
yarn 설치 명령어
yarn
이렇게 하나의 명령어만 쳐도 그 안의 모듈을 같이 설치해준다.
main branch 를 clone 한 후 깃허브에서 dev branch 를 만들면 remote dev branch 가 생긴다.
git branch -r
내 vs code 에서 해당 폴더의 원격 브랜치를 확인하면
origin/HEAD -> origin/main
origin/dev
origin/main
이렇게 확인할 수 있다.
이제 내 local branch에 remote branch dev를 가져와야 한다.
git pull origin dev
그러나 내 local branch에 dev가 생기지 않았다.
나의 yarn version 과 remote 에서 설치된 yarn version 이 달랐기 때문
git status
//On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: package.json
modified: yarn.lock
Untracked files:
(use "git add <file>..." to include in what will be committed)
.yarn/
.yarnrc.yml
no changes added to commit (use "git add" and/or "git commit -a")//
.yarn 폴더에 yarn cache 파일들이 추가되어 있었다.
나는 내 vs code 에서
git stash
이렇게 변경 이력들을 stash 하고
git checkout -t origin/dev
remote branch를 내 local branch에도 추가한다.
📌
git checkout -t (remote branch명)
remote branch를 내 local branch에도 추가하는 명령어
git stash drop
stash 내역을 버린다. 다시 내 local branch 확인하면
yarn-branch
dev branch 가 생겼음을 알 수 있다.
.gitignore 추가된 원격 repo 를 내 repo 로 가져오기
-> git pull 덮어쓰기
git fetch --all
git reset --hard origin/dev
⭐️ git flow 전략 기억하기
: main 을 만들고 각자 clone 하고 dev 추가하기
-> dev 안의 feature branch 에서 작업하고 기능별로 작업이 끝나면 합친 뒤 branch 를 삭제하고 main에 반영한다.
-> 다른 기능의 feature branch 만들어서 위와 같이 작업하기
Yarn Berry로 node_modules를 해치우자
서론 npm과 yarn v1이 가지고 있던 고질적인 문제점을 해결해주는 Yarn Berry의 등장! node_modules의 큰 용량 차지, package.json에 명시되어있지 않은 패키지를 사용하는 유령 의존성 등을 해결해줄 수 있다
nukw0n-dev.tistory.com
✔️ 이미 remote에 올라가면 안되는 파일이 추가됐는데 local의 gitignore에서 해당 파일을 처리한다면?
: 이미 remote에 올라갔기 때문에 remote 에서 삭제해야 함
✔️ node-modules 폴더는 깃허브에 올리는 게 아님
※ git flow, axios instance, mock data, theme 설정, 리액트 폴더 구조, 컴포넌트 재사용성
'Edu_hanghae99 > TIL' 카테고리의 다른 글
[TIL] 221220 (0) | 2022.12.21 |
---|---|
[TIL] 221219 (0) | 2022.12.19 |
[TIL] 오류와 오류와 오류 221214 (0) | 2022.12.13 |
[TIL] 리액트 심화 주차 팀 과제_리덕스 툴킷 (2) | 2022.12.12 |
[TIL] 나 6시간만 더 줘요 221210 (1) | 2022.12.10 |