Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
Tags
- loss functions
- objective functions for machine learning
- rest-api
- sidleup
- pulloff
- remove outliers
- noise contrast estimation
- Knowledge Distillation
- resample
- model-free control
- straightup
- shadowing
- freebooze
- Policy Gradient
- sample rows
- REINFORCE
- non parametic softmax
- MRI
- clip intensity values
- Inorder Traversal
- thresholding
- Excel
- Actor-Critic
- normalization
- 자료구조
- scowl
- fastapi
- checkitout
- 3d medical image
- domain adaptation
Archives
- Today
- Total
Let's Run Jinyeah
Git Branch & Merge 본문
Q. 수정 사항들을 local repository의 master branch에 바로 반영하고 싶지 않을 때는 어떻게 해야 할까?
새로운 branch를 생성하고 생성한 branch에서 수정한 후, 수정 사항들을 master branch에 merge한다.
1. 새로운 branch 생성 및 삭제
//branch 생성
git branch <branch_name>
//branch 삭제
git branch -d <branch_name>
//branch 강제 삭제
git branch -D <branch_name>
2. active(current) branch를 새로운 branch로 변경
- active(current) branch란? local repository에 해당하는 branch
- branch를 변경하면 local repository와 git status는 해당 branch의 내용을 보여준다.
- 반면, remote repository(Github)는 항상 master branch를 보여준다.
git checkout <branch_name>
3. 새로운 branch를 생성하면서 동시에 새로운 branch로 변경
git checkout -b <branch_name>
4. 새로운 branch에서의 수정사항을 master branch에 반영
<working-directory> (new_branch)$ git commit -m "<message>" //새로운 branch에서 수정사항을 commit
<working-directory> (new_branch)$ git checkout master //master branch로 이동
<working-directory> (master)$ git merge <name-of-branch-to-merge-in> //새로운 branch를 병합
※ 주의!!
새로운 branch의 수정사항을 commit하지 않고 다른 branch로 이동하면, 자동으로 수정사항이 checkout하는 branch로 반영이 되고 충돌이 일어날 수 있다.
Q. commit하지 않고 다른 branch로 이동하려면 어떻게 해야 할까?
다른 공간에 변경 내역을 기록해 두고 다른 branch로 이동해서 작업한 후에 다시 돌아와서 변경 내역을 불러와 계속 작업을 이어나간다.
git stash //코드를 잠시 stash 영역에 저장
git stash list //stash 영역에 저장한 목록 확인
git stash apply //가장 최근 stash 불러오기
git stash apply <stash 이름> //특정 stash 불러오기
git stash drop //가장 최근 stash 제거하기
'Programming > Git&Github' 카테고리의 다른 글
로컬 저장소를 새로운 Github 저장소에 등록 (0) | 2021.02.11 |
---|---|
Git Merge 충돌 해결 단계 (0) | 2021.02.11 |
Git Push 실패 - Pull & Fetch & Merge (0) | 2021.02.11 |
Git reset & checkout & ignore (0) | 2020.02.03 |
Git add & commit & push & 상태확인 (2) | 2020.01.10 |
Comments