git 명령어
-
GIT merge2022.06.21
-
GIT push2022.06.21
-
GIT commit2022.06.21
-
GIT stash2022.06.21
-
GIT clean2022.06.21
GIT merge
2022. 6. 21. 22:10
반응형
merge 란?
- git merge는 다른 브랜치를 현재 Checkout된 브랜치에 Merge 하는 명령으로, Merge 하고 나서 현재 브랜치가 Merge 된 결과를 가리키도록 옮긴다.
merge 명령어
- 서로 다른 branch 병합 하기
git checkout {branchA}
git merge {branchB} //A에 B 변경 내역을 병합
git merge --continue // 병합 저장
git merge --abort // 병합 롤백
- 특정 브랜치에서 file 1개만 merge 하기
git checkout {branchA} {filename} //A branch 에서 file 1개 merge
반응형
'Infra > git' 카테고리의 다른 글
GIT rebase (0) | 2022.06.21 |
---|---|
GIT push (0) | 2022.06.21 |
GIT commit (0) | 2022.06.21 |
GIT stash (0) | 2022.06.21 |
GIT clean (0) | 2022.06.21 |
GIT push
2022. 6. 21. 22:04
반응형
push
local repository에 commit 이력을 remote branch 로 보낼 경우 사용
git push origin {branch}
git push origin {branch} -f // remote force push
최근 commit 이력을 취소하고 push(remote에 잘못된 commit 이력을 push 했을 경우)
git reset HEAD^
git push origin master -f
commit history 전부 삭제하고 초기 상태로 되돌릴 경우
rm -rf .git
git init
git add .
git commit -m "feat(init): initial commit"
git push origin master
반응형
'Infra > git' 카테고리의 다른 글
GIT merge (0) | 2022.06.21 |
---|---|
GIT rebase (0) | 2022.06.21 |
GIT commit (0) | 2022.06.21 |
GIT stash (0) | 2022.06.21 |
GIT clean (0) | 2022.06.21 |
GIT commit
2022. 6. 21. 22:02
반응형
commit
- 작업 중인 파일 내역 저장 (원격 저장소 push 전 수행)
- 작업시 기능 단위로 나눠서 #commit 하면 코드 리뷰 시 리뷰어가 보기 편함
git commit -m "commit init"
git commit --amend //message vi 모드
git commit --amend -m "메세지 변경" //message 변경
git reset HEAD^ or git reset {commit id} //local commit 취소
git commit --allow-empty -m "empty commit" //empty commit
반응형
'Infra > git' 카테고리의 다른 글
GIT rebase (0) | 2022.06.21 |
---|---|
GIT push (0) | 2022.06.21 |
GIT stash (0) | 2022.06.21 |
GIT clean (0) | 2022.06.21 |
GIT restore (0) | 2022.06.21 |
GIT stash
2022. 6. 21. 22:00
반응형
stash
- workspace에서 수정 중인 파일 임시 저장
- 작업 중 #브랜치 전환할 경우 수정 중인 파일 임시로 저장 후 스위칭시 유용함
git stash save {stashname}
git stash list //목록 보기
git stash clear // 전체 삭제
git stash apply stash@{0} //저장된 stash 불러오기
git stash pop //가장 마지막에 save한 stash 불러오기
반응형
'Infra > git' 카테고리의 다른 글
GIT push (0) | 2022.06.21 |
---|---|
GIT commit (0) | 2022.06.21 |
GIT clean (0) | 2022.06.21 |
GIT restore (0) | 2022.06.21 |
GIT add (0) | 2022.06.21 |
GIT clean
2022. 6. 21. 21:57
반응형
clean
- untracked file 삭제해야 할 경우
git clean -f // untracked file
git clean -d // untracked folder
git clean -fd // file 및 folder 까지
반응형
'Infra > git' 카테고리의 다른 글
GIT commit (0) | 2022.06.21 |
---|---|
GIT stash (0) | 2022.06.21 |
GIT restore (0) | 2022.06.21 |
GIT add (0) | 2022.06.21 |
GIT cherry-pick (0) | 2022.06.21 |