«   2021/03   »
  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      
03-06 15:48
Notice
Today
40
Total
1,407,985
관리 메뉴

변군이글루

[GIT] 깃 브랜치(git branch) 생성, 삭제 본문

* 리눅스

[GIT] 깃 브랜치(git branch) 생성, 삭제

변군 변군이글루 2021. 1. 27. 11:39

git branch 생성, 삭제

로컬 branch 생성(Deployment environment)

git branch [<options>] (-c | -C) [<old-branch>] <new-branch>

git checkout -b "testing"

$ git checkout -b "testing"
Switched to a new branch 'testing'

$ git checkout -b "staging"
Switched to a new branch 'staging'

branch 확인(현재 branch)

git branch --list

git branch

$ git branch
--
  dev
  master
  testing
* staging
---

로컬 branch 이름 변경(dev -> development)

git branch [<options>] (-m | -M) [<old-branch>] <new-branch>

git branch -m dev development

로컬 branch 삭제

git branch [<options>] [-r] (-d | -D) <branch-name>

git branch -D dev

$ git branch -d dev
Deleted branch dev (was e178f0c).

$ git branch -D ggg
Deleted branch ggg (was f2b8f21).

branch 확인(현재 branch)

git branch

$ git branch
---
  development
  master
  production
* staging
  testing
(END)
---

원격 저장소에 branch 생성

git push origin staging

$ git push origin staging
Total 0 (delta 0), reused 0 (delta 0)
remote:
remote: To create a merge request for staging, visit:
remote:   http://gitlab.sangchul.kr/playground/merge_requests/new?merge_request%5Bsource_branch%5D=staging
remote:
To http://gitlab.sangchul.kr/playground.git
 * [new branch]      staging -> staging

원격 저장소에 branch 삭제

git push origin :dev

$ git push origin :dev
To http://gitlab.sangchul.kr/playground.git
 - [deleted]         dev

 

0 Comments
댓글쓰기 폼