。゚(*´□`)゚。

코딩의 즐거움과 도전, 그리고 일상의 소소한 순간들이 어우러진 블로그

[네이버클라우드] 클라우드 기반의 개발자 과정 7기/웹프로그래밍

git 사용

quarrrter 2023. 9. 14. 19:43

PS C:\Users\bitcamp\git\test-app> git branch b1

 

PS C:\Users\bitcamp\git\test-app> git branch
  b1
* main

 

브랜치 삭제

꺼내기: checkout

head 교체

 

작업끝나면 브랜치 날려버리깅 

그때그때 브랜치따서 작업하기 

PS C:\Users\bitcamp\git\test-app> git checkout b1
error: The following untracked working tree files would be overwritten by checkout:
        .idea/misc.xml
        .idea/modules.xml
        .idea/modules/app/test-app.app.main.iml
Please move or remove them before you switch branches.
Aborting
PS C:\Users\bitcamp\git\test-app> rm .idea/misc.xml
PS C:\Users\bitcamp\git\test-app> git checkout main
error: The following untracked working tree files would be overwritten by checkout:
        .idea/modules.xml
        .idea/modules/app/test-app.app.main.iml
Please move or remove them before you switch branches.
Aborting
PS C:\Users\bitcamp\git\test-app> git log --oneline --all --graph
* 35ae07d (b1) test2 추가
* 330b327 test1 추가
* 344ea87 (origin/main, origin/HEAD, main) chore : update .gitignore, replace : move images/
* 1e32f44 .
* 8421929 (HEAD) Initial commit
PS C:\Users\bitcamp\git\test-app> git branch
* (HEAD detached at 8421929)
  b1
  main
PS C:\Users\bitcamp\git\test-app> git checkout main
error: The following untracked working tree files would be overwritten by checkout:
        .idea/modules.xml
        .idea/modules/app/test-app.app.main.iml
Please move or remove them before you switch branches.
Aborting
PS C:\Users\bitcamp\git\test-app> git stash apply
No stash entries found.
PS C:\Users\bitcamp\git\test-app> git stash
No local changes to save
PS C:\Users\bitcamp\git\test-app> mv .idea/modules.xml ~/Desktop/modules.xml
PS C:\Users\bitcamp\git\test-app> git checkout main
error: The following untracked working tree files would be overwritten by checkout:
        .idea/modules/app/test-app.app.main.iml
Please move or remove them before you switch branches.
Aborting
PS C:\Users\bitcamp\git\test-app> mv .idea/modules.xml ~/Desktop/modules.xml
Move-Item: Cannot find path 'C:\Users\bitcamp\git\test-app\.idea\modules.xml' because it does not exist.
PS C:\Users\bitcamp\git\test-app> rm .idea/modules.xml
Remove-Item: Cannot find path 'C:\Users\bitcamp\git\test-app\.idea\modules.xml' because it does not exist.
PS C:\Users\bitcamp\git\test-app> git checkout b2
error: pathspec 'b2' did not match any file(s) known to git
PS C:\Users\bitcamp\git\test-app> git checkout main
error: The following untracked working tree files would be overwritten by checkout:
        .idea/modules/app/test-app.app.main.iml
Please move or remove them before you switch branches.
Aborting
PS C:\Users\bitcamp\git\test-app> rm .idea/modules/app/test-app.app.main.iml
PS C:\Users\bitcamp\git\test-app> git checkout main
error: The following untracked working tree files would be overwritten by checkout:
        .idea/misc.xml
Please move or remove them before you switch branches.
Aborting
PS C:\Users\bitcamp\git\test-app> rm .idea/misc.xml
PS C:\Users\bitcamp\git\test-app> git checkout main
Previous HEAD position was 8421929 Initial commit
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
PS C:\Users\bitcamp\git\test-app> git branch b2
PS C:\Users\bitcamp\git\test-app> git checkout b2
Switched to branch 'b2'
PS C:\Users\bitcamp\git\test-app> git add .
PS C:\Users\bitcamp\git\test-app> git commit -m "test4 추가"
[b2 69d5c7f] test4 추가
 1 file changed, 11 insertions(+)
 create mode 100644 app/src/main/resources/static/index4.html
PS C:\Users\bitcamp\git\test-app> git add .
PS C:\Users\bitcamp\git\test-app> git commit -m "test5 추가"
[b2 32ddd81] test5 추가
 1 file changed, 11 insertions(+)
 create mode 100644 app/src/main/resources/static/index5.html
PS C:\Users\bitcamp\git\test-app> git log --oneline --all --graph
* 32ddd81 (HEAD -> b2) test5 추가
* 69d5c7f test4 추가
| * 35ae07d (b1) test2 추가
| * 330b327 test1 추가
|/
* 344ea87 (origin/main, origin/HEAD, main) chore : update .gitignore, replace : move images/
* 1e32f44 .
* 8421929 Initial commit
PS C:\Users\bitcamp\git\test-app> git checkout main
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
PS C:\Users\bitcamp\git\test-app>
PS C:\Users\bitcamp\git\test-app> git checkout main
Already on 'main'
Your branch is up to date with 'origin/main'.
PS C:\Users\bitcamp\git\test-app> git merge b2
Updating 344ea87..32ddd81
Fast-forward
 app/src/main/resources/static/index4.html | 11 +++++++++++
 app/src/main/resources/static/index5.html | 11 +++++++++++
 2 files changed, 22 insertions(+)
 create mode 100644 app/src/main/resources/static/index4.html
 create mode 100644 app/src/main/resources/static/index5.html
PS C:\Users\bitcamp\git\test-app> git log --oneline --all --graph
* 32ddd81 (HEAD -> main, b2) test5 추가
* 69d5c7f test4 추가
| * 35ae07d (b1) test2 추가
| * 330b327 test1 추가
|/
* 344ea87 (origin/main, origin/HEAD) chore : update .gitignore, replace : move images/
* 1e32f44 .
* 8421929 Initial commit
PS C:\Users\bitcamp\git\test-app> git merge b2
Already up to date.
PS C:\Users\bitcamp\git\test-app> git log --oneline --all --graph
* 32ddd81 (HEAD -> main, b2) test5 추가
* 69d5c7f test4 추가
| * 35ae07d (b1) test2 추가
| * 330b327 test1 추가
|/
* 344ea87 (origin/main, origin/HEAD) chore : update .gitignore, replace : move images/
* 1e32f44 .
* 8421929 Initial commit
PS C:\Users\bitcamp\git\test-app> git checkout main
Already on 'main'
Your branch is ahead of 'origin/main' by 2 commits.
  (use "git push" to publish your local commits)
PS C:\Users\bitcamp\git\test-app> git log --oneline --all --graph
* 32ddd81 (HEAD -> main, b2) test5 추가
* 69d5c7f test4 추가
| * 35ae07d (b1) test2 추가
| * 330b327 test1 추가
|/
* 344ea87 (origin/main, origin/HEAD) chore : update .gitignore, replace : move images/
* 1e32f44 .
* 8421929 Initial commit
PS C:\Users\bitcamp\git\test-app> git branch -d b2
Deleted branch b2 (was 32ddd81).
PS C:\Users\bitcamp\git\test-app> git branch
  b1
* main
PS C:\Users\bitcamp\git\test-app>

'[네이버클라우드] 클라우드 기반의 개발자 과정 7기 > 웹프로그래밍' 카테고리의 다른 글

9/15  (0) 2023.09.15
9/14  (0) 2023.09.14
9/13 프로젝트  (0) 2023.09.13
9/13  (0) 2023.09.13
9/12 스프링부트  (0) 2023.09.12