Git 단계별 진급---Git 분기 생성 및 삭제
# , temp
cc@cc-PC MINGW64 /f/my-center/cloud/server-services-config (master)
$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
# temp
cc@cc-PC MINGW64 /f/my-center/cloud/server-services-config (master)
$ git branch temp
# , temp
cc@cc-PC MINGW64 /f/my-center/cloud/server-services-config (master)
$ git branch -a
* master
temp
remotes/origin/HEAD -> origin/master
remotes/origin/master
# temp
cc@cc-PC MINGW64 /f/my-center/cloud/server-services-config (master)
$ git checkout temp
Switched to branch 'temp'
M consumer-task/pom.xml
# , * temp temp
cc@cc-PC MINGW64 /f/my-center/cloud/server-services-config (temp)
$ git branch -a
master
* temp
remotes/origin/HEAD -> origin/master
remotes/origin/master
또한 원격 분기가 이미 있는 경우 원격 분기를 사용하여 로컬 분기를 생성할 수도 있습니다.
원격 분기 생성
#
cc@cc-PC MINGW64 /f/my-center/cloud/server-services-config (temp)
$ vim README
#add
cc@cc-PC MINGW64 /f/my-center/cloud/server-services-config (temp)
$ git add README
warning: LF will be replaced by CRLF in README.
The file will have its original line endings in your working directory.
#commit
cc@cc-PC MINGW64 /f/my-center/cloud/server-services-config (temp)
$ git commit -m "add README"
[temp 95447d5] add README
1 file changed, 1 insertion(+)
create mode 100644 README
#push temp push temp; temp, temp , temp temp
cc@cc-PC MINGW64 /f/my-center/cloud/server-services-config (temp)
$ git push origin temp:temp
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 293 bytes | 146.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote:
remote: To create a merge request for temp, visit:
remote: http://gitlab.ushareit.org:8000/interlive/cloud/server-services-config/merge_requests/new?merge_request%5Bsource_branch%5D=temp
remote:
To gitlab.ushareit.org:interlive/cloud/server-services-config.git
* [new branch] temp -> temp
# , remotes/origin/temp
cc@cc-PC MINGW64 /f/my-center/cloud/server-services-config (temp)
$ git branch -a
master
* temp
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/temp
원격 분기 삭제
# temp
cc@cc-PC MINGW64 /f/my-center/cloud/server-services-config (temp)
$ git push origin --delete temp
To gitlab.ushareit.org:interlive/cloud/server-services-config.git
- [deleted] temp
# temp
cc@cc-PC MINGW64 /f/my-center/cloud/server-services-config (temp)
$ git branch -a
master
* temp
remotes/origin/HEAD -> origin/master
remotes/origin/master
# 요약하면 다음과 같은 두 가지 방식이 있고 두 번째 방식도 비교적 자주 사용된다. 1) 명령git push origin - delete temp(temp는 원격 지점 이름) 2) 명령git push origin 사용:temp
로컬 브랜치 삭제
# , temp
cc@cc-PC MINGW64 /f/my-center/cloud/server-services-config (temp)
$ git branch -a
master
* temp
remotes/origin/HEAD -> origin/master
remotes/origin/master
# ,
cc@cc-PC MINGW64 /f/my-center/cloud/server-services-config (temp)
$ git checkout master
Switched to branch 'master'
M weshow-sqs-consumer-task/pom.xml
Your branch is up to date with 'origin/master'.
# change,
cc@cc-PC MINGW64 /f/my-center/cloud/server-services-config (master)
$ git branch -d temp
error: The branch 'temp' is not fully merged.
If you are sure you want to delete it, run 'git branch -D temp'.
#
cc@cc-PC MINGW64 /f/my-center/cloud/server-services-config (master)
$ git branch -D temp
Deleted branch temp (was 95447d5).
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
【Visual Studio 2017】 타인의 GitHub 리포지토리에 푸시하는 방법이 기사에서는 Visual Studio 2017에서 GitHub를 다루는 기사입니다. "Git for Windowws"나 "Visual Studio GitHub 연동 구성 요소"를 도입하지 않은 경우 을 참조하십시오...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.