-
# 브랜치!
- 하나의 코드 관리 흐름
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (master)
$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (master)
$ git history
75494b3b9c8516938bbf65d1fdf5ee8348cef63f (HEAD -> master, tag: Version_2, origin/master) Add multiply function
23453a29860fb3bce2a87749717bfd6f1dfc0100 Add the info in README.md
74b3b85cae59f4dc2daaee15110fc7724a1812a1 readme수정
b69451e5813c4f433746acbf77a92e34a2fbb299 Update README.md
095343435235eb984761d9b19bc9c39213258237 Make REAME.md looknice
cfe4b0bcf749debcda87423ff08a0381d98d7619 add the info of calculator.py
7bcb609ce8f66cc54e82af9275a0bfe558c03de6 Create REAME.me
d5881c1e25101fa9b754a2fe7a1ded886169167f add revised texts
c30c6dc1c7cdf593952cc3cd7099b3c579c0a7b2 (tag: Version_1) Create caculator.py and License
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (master)
$ git branch yunaaa
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (master)
$ git checkout yunaaa
Switched to branch 'yunaaa'
// yunaaa라는 branch로 이동했다. 따라서 main branch와는 아무 상관이 없다.
작업을 해서 yunaaa라는 branch에 올리면 main branch와는 아무런 상관이 없다
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (yunaaa)
$ git status
On branch yunaaa
nothing to commit, working tree clean
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (yunaaa)
$ git status
On branch yunaaa
nothing to commit, working tree clean
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (yunaaa)
$ ^C
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (yunaaa)
$ start .
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (yunaaa)
$ git add .
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (yunaaa)
$ git commit -m "Change License from free to premium"
[yunaaa 10f2f43] Change License from free to premium
1 file changed, 1 insertion(+), 1 deletion(-)
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (yunaaa)
$ cat License
# 기본라이센스
유료
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (yunaaa)
$ git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (master)
$ cat License
# 기본라이센스
Free
-========================================
# branch만들기, 삭제하기
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (master)
$ git branch
* master
yunaaa
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (master)
$ git branch test
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (master)
$ git branch
* master
test
yunaaa
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (master)
$ git branch -d test
Deleted branch test (was 75494b3).
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (master)
$ git branch
* master
yunaaa
# branch 만들고 바로 이동해보기
git checkout -b [브랜치이름]
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (master)
$ git checkout -b test
Switched to a new branch 'test'
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (test)
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (test)
$ git branch
master
* test
yunaaa
=============================
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (test)
$ git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
yunajoe@DESKTOP-ULNOHTM MINGW64 ~/Desktop/Git_Practice (master)
$ git branch -d test
Deleted branch test (was 75494b3).
=============================
1. test라는 브랜치를 생성하고 그 브랜치로 바로 이동하려고 할 때
- git checkout -b test
2. test라는 브랜치를 삭제하려고 할 때
- git checkout -d test'Git' 카테고리의 다른 글
git reset (0) 2023.02.19 커밋메시지 다루기 (m옵션 없이 메세지 남기기, 최신 커밋 수정하기, as로 별칭 만들기, 두 커밋 간의 차이보기) (0) 2023.02.19 커밋 히스토리 (0) 2023.02.19 오픈소스(Open Source) & Glt Clone해보기 (0) 2022.09.22 Remote repository와 Local repository를 연결해보기 (0) 2022.09.17