본문 바로가기

# 04/Git

[Git] git 정리

반응형

 1. 새로운 브랜치 생성 

 

VCS - Git - Branches

 

New Branch 

v1_0_2

(새로운 브랜치 생성)

 

push (origin 옆에 브랜치 확인하기)

 

 

 2. 태그 추가 

 

마스터로 변경 후 

 

VCS - Git - Tag

v1_0_1

 

- 태그 push

git push --tags

 

- 태그 보기

git tag

 

- 태그 지우기

git tag -d v1_0_1
 

 3. 머지 

 

마스터로 변경 후 

VCS - Git - Merge Changes

머지 후 push 하면 됨!!

 

 

 4. 브랜치 삭제 

 

VCS - Git - Branches

삭제하고 싶은 해당 브랜치 옆에 클릭 후 Delete 하면 됨.

 

 

 5. 브랜치 이름 변경 

 

1. branch 이름 변경 하기

git branch -m old_branch new_branch

2. 이전 branch 제거 

git push origin :old_branch 
3. 변경한 새로운 브런치를 업로드
git push --set-upstream origin new_branch

 

 

 6. branch & tag 이름 같을 시에 push 하면 발생하는 에러 

 

git error: dst refspec 3.2 matches more than one.

Here's how to delete the branch:

git push origin :heads/3.2

 

And here's how to delete the tag:

git push origin :tags/3.2

 

 7. git commit/push 제거 

 

안드로이드 스튜디오 경우 원하는 커밋 위치에서 

Reset Current Branch to Here... Hard

클릭 후 

 

$ git push origin [branch name] -f

강제 푸시 업데이트 해주면 됨!

 

 

 

1. 원하는 시점으로 commit 되돌리기 (git reset)
2. 되돌려진 상태에서 다시 commit (git commit)
3. 원격 저장소에 강제로 push (git push -f origin [branch name])

반응형

'# 04 > Git' 카테고리의 다른 글

[Git] git 협업  (0) 2019.12.07
[Git] gitlab 코드 올리기  (0) 2019.09.05
[Git] Octotree 토큰  (0) 2019.08.22
[Git] 안드로이드스튜디오, 깃, 깃허브 활용  (0) 2019.08.20
[Git] GitHub TIP  (0) 2019.08.16