728x90

๐Ÿ“š Computer Science/Git 10

[Git] ์›๊ฒฉ์ €์žฅ์†Œ์— Push ํ•œ Commit ์‚ญ์ œํ•˜๊ธฐ

1. ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์‚ญ์ œํ•  commit ์„ ํ™•์ธ. git log 2. ๊ฐ€์žฅ ๋งˆ์ง€๋ง‰์— push ํ•œ(๊ฐ€์žฅ ์œ„์— ์žˆ๋Š”) commit ์„ ์ง€์šฐ๊ณ  ์‹ถ๊ธฐ ๋•Œ๋ฌธ์— ๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ commit ์„ ์‚ญ์ œํ•œ๋‹ค. git reset HEAD^ 3. ๊ทธ๋ฆฌ๊ณ  ๋‚ด๊ฐ€ commit ์„ ์ง€์› ๋‹ค๋Š” ๊ฒƒ์„ github ์„œ๋ฒ„์— ์•Œ๋ ค์ฃผ์–ด github ๋‚ด์—์„œ๋„ ํ•ด๋‹น commit ์„ ์‚ญ์ œํ•˜๋„๋ก ํ•œ๋‹ค. git push -f origin "๋ธŒ๋žœ์น˜๋ช…" cf) master ์—์„œ push ํ•œ commit ์„ ์‚ญ์ œํ•˜๋ ค๋ฉด git push -f origin master ๋ฅผ ์ž…๋ ฅํ•ด์ฃผ๋ฉด ๋œ๋‹ค.

[GitHub Packages] GitHub Packages

GitHub Packages documentation - GitHub Docs Learn to safely publish and consume packages, store your packages alongside your code, and share your packages privately with your team or publicly with the open source community. You can also automate your packages with GitHub Actions. docs.github.com *GitHub Packages ๋ณ„๋„์˜ ์„ค์น˜๋‚˜ ์…‹ํŒ… ์—†์ด *npm, *Apache maven, *rubygems, *Gradle, *NuGet ํŒจํ‚ค์ง€ ๋ฐ Docker Image๋ฅผ ๋ฐฐํฌ..

[Git] Commit ํ•ฉ์น˜๊ธฐ & Commit ๋ฉ”์„ธ์ง€ ์ˆ˜์ •(rebase)

rebase๋ฅผ ์‚ฌ์šฉํ•ด์„œ 11๊ฐœ์˜ ์ปค๋ฐ‹์„ ํ•ฉ์ณ๋ด…์‹œ๋‹น. [๋กœ์ปฌ ์ €์žฅ์†Œ์— Commit ํ•œ๊ฑฐ ํ•ฉ์น˜๊ธฐ] 1. ํ„ฐ๋ฏธ๋„์„ ์—ด์–ด์„œ ์•„๋ž˜ ๊ตฌ๋ฌธ ์ž…๋ ฅ git rebase -i HEAD~3 2. ํ•ฉ์น  commit ์„ ํƒํ•ด์„œ ํ‚ค์›Œ๋“œ๋ฅผ s ๋กœ ๋ฐ”๊ฟ”์ค๋‹ˆ๋‹ค. : ๋งจ ์œ„ commit ๋ฉ”์„ธ์ง€(๋งจ ๋งˆ์ง€๋ง‰ ์ปค๋ฐ‹)๋Š” pick์œผ๋กœ ๋ƒ…๋‘๊ณ  ํ•ฉ์น  commit ๋ฉ”์„ธ์ง€๋“ค(๋‚˜๋จธ์ง€)๋Š” s๋กœ ๋ฐ”๊พผ๋‹ค. : vi ํŽธ์ง‘ํ•  ๋• esc ํ‚ค ๋ˆ„๋ฅด๊ณ  i ๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ๋˜๊ณ , :wq ๋ฅผ ์ž…๋ ฅํ•ด์„œ ์ €์žฅํ›„ ์ข…๋ฃŒํ•ด์ค€๋‹ค. 3. ์ปค๋ฐ‹ ๋ฉ”์„ธ์ง€๋ฅผ ์ˆ˜์ •ํ•ฉ๋‹ˆ๋‹ค. : ์ปค๋ฐ‹์„ ํ•ฉ์ณค์„ ๋•Œ commit ๋ฉ”์„ธ์ง€๋ฅผ ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ๋‹ค. ์ด๋Œ€๋กœ ์ €์žฅ์ข…๋ฃŒํ•˜๋ฉด ๋ชจ๋“  ์ปค๋ฐ‹ ๋ฉ”์„ธ์ง€๊ฐ€ ์‹น ๋‚˜์˜จ๋‹ค. ํ•„์š”์—†๋Š” ์ปค๋ฐ‹ ๋ฉ”์„ธ์ง€๋ฅผ ์ง€์›Œ์ฃผ๊ณ  ํ•œ์ค„๋กœ ์ •๋ฆฌํ•ด์ฃผ์ž. 4. ์ €์žฅํ›„ ์™„๋ฃŒํ•ด์„œ ๊ฒฐ๊ณผ ํ™•์ธํ•˜๊ณ  push ํ•˜๊ธฐ ! : 11๊ฐœ..

[Git] git commit ๋ฉ”์„ธ์ง€ ์ˆ˜์ • ๋ฐฉ๋ฒ•

1. ๊ฐ€์žฅ ์ตœ๊ทผ์˜ commit ์ˆ˜์ • git commit --amend vi ํ„ฐ๋ฏธ๋„์—์„œ ๋ฉ”์‹œ์ง€ ์ˆ˜์ •ํ›„ :wq(์ €์žฅ ํ›„ ์ฐฝ ๋‹ซ๊ธฐ) ๋ฅผ ํ•ด์ฃผ๋ฉด ๋ฉ๋‹ˆ๋‹ค. 2. ์˜ค๋ž˜๋œ commit ์ˆ˜์ • or ํ•œ ๋ฒˆ์— ์—ฌ๋Ÿฌ commit ์ˆ˜์ • ์œ„์—์„œ๋ถ€ํ„ฐ ์„ธ ๋ฒˆ์งธ ์ปค๋ฐ‹์„ ์ˆ˜์ •ํ•ด์•ผ ํ•œ๋‹ค๋ฉด git rebase -i HEAD~3 1) ์œ„ ์ปค๋งจ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ํ˜„์žฌ ์ž‘์—…์ค‘์ธ ๋ธŒ๋žœ์น˜์˜ ๊ฐ€์žฅ ์ตœ๊ทผ commit 3๊ฐœ๋ฅผ ๋ณด์—ฌ์ฃผ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. 2) ์ฐฝ์ด ๋œจ๋ฉด, ์ˆ˜์ •ํ•˜๊ณ  ์‹ถ์€ ์ปค๋ฐ‹ ์˜†์˜ pick ์ด๋ผ๋Š” ๋ฌธ๊ตฌ๋ฅผ reword ๋กœ ๋ฐ”๊ฟ” ์ฃผ๋ฉด ๋ฉ๋‹ˆ๋‹ค. 3) esc -> :wq ๋ฅผ ํ†ตํ•ด ์ปค๋ฐ‹ ๋ฆฌ์ŠคํŠธ๋ฅผ ์ €์žฅ์„ ํ•ด์ฃผ๊ณ  ๋‚˜๋ฉด, ๋‘ ๊ฐœ์˜ ์ปค๋ฐ‹์„ ๊ฐ๊ฐ ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ๋Š” ์ฐฝ์ด ์ˆœ์„œ๋Œ€๋กœ ๋„์›Œ์ง‘๋‹ˆ๋‹ค. ์›ํ•˜๋Š”๋Œ€๋กœ ์ปค๋ฐ‹์„ ์ˆ˜์ •ํ•˜๊ณ  :wq ๋ฅผ ํ†ตํ•ด ์ €์žฅํ•ฉ๋‹ˆ๋‹ค. 3. remote์— ์ด๋ฏธ p..

[Git Error] fatal: Cannot setup tracking information; starting point 'branch' is not a branch.

์—๋Ÿฌ: ๋กœ์ปฌ ๋ธŒ๋žœ์น˜ ์—†์ด ์›๊ฒฉ ๋ธŒ๋žœ์น˜๋ฅผ ์ถ”์ ํ•˜๋ ค๊ณ  ํ–ˆ๋‹ค๊ฐ€ ๋งŒ๋‚œ ์—๋Ÿฌ. fatal: Cannot setup tracking information; starting point 'branch' is not a branch. ์›์ธ: ๋กœ์ปฌ ๋ธŒ๋žœ์น˜๊ฐ€ ์›๊ฒฉ ๋ธŒ๋žœ์น˜๋ฅผ ์ถ”์ ํ•˜์ง€ ๋ชปํ•ด์„œ ๊ทธ๋Ÿฐ ๊ฒƒ. ์ฆ‰ ์›๊ฒฉ ๋ธŒ๋žœ์น˜๋ฅผ ์ถ”์ ํ•  ๋กœ์ปฌ ๋ธŒ๋žœ์น˜๊ฐ€ ์—†์Œ. ํ•ด๊ฒฐ์ฑ…: ์›๊ฒฉ ๋ธŒ๋žœ์น˜ ์—ฐ๊ฒฐ์„ ๋Š์—ˆ๋‹ค๊ฐ€ ๋‹ค์‹œ ์—ฐ๊ฒฐํ•ด์ฃผ๋ฉฐ ๋œ๋‹ค. #1. ์—ฐ๊ฒฐ๋˜์–ด ์žˆ๋Š” ์›๊ฒฉ ๋ธŒ๋žœ์น˜ ํ™•์ธ git remote -v #2. ์—ฐ๊ฒฐ๋˜์–ด ์žˆ๋Š” ์›๊ฒฉ ๋ธŒ๋žœ์น˜ ๋Š๊ธฐ git remote remove [์›๊ฒฉ ๋ธŒ๋žœ์น˜ ์ด๋ฆ„] #3. ์ž˜ ๋Š๊ฒผ๋Š”์ง€ ํ™•์ธ git remote -v #4. ์›๊ฒฉ์ €์žฅ์†Œ ์ฃผ์†Œ๋ฅผ ์ด์šฉํ•ด ์›๊ฒฉ ๋ธŒ๋žœ์น˜ ๋‹ค์‹œ ์—ฐ๊ฒฐ. git remote add remote [์›๊ฒฉ์ €์žฅ์†Œ ์ฃผ์†Œ] ..

[Git Clone Errror & Solution] curl 18 transfer closed with outstanding read data remaining

Error: error: RPC failed; curl 18 transfer closed with outstanding read data remaining fetch-pack: unexpected disconnect while reading sideband packet fatal: protocol error: bad pack header ๊นƒ ํด๋ก  ์ค‘, ์ฝ๊ธฐ ๋ฐ์ดํ„ฐ๊ฐ€ ๋‚จ์•„์žˆ๋‹ค๋Š” ์—๋Ÿฌ์™€ ํ•จ๊ป˜ ์ €์žฅ์†Œ ๋‚ด์šฉ์ด ๋ฐ›์•„์™€์ง€์ง€ ์•Š์•˜๋‹ค. ์—๋Ÿฌ๋กœ ๊ตฌ๊ธ€๋งํ•ด๋ณด๋‹ˆ, ํŒŒ์ผ์ด ํฌ๊ฑฐ๋‚˜ ๋„คํŠธ์›Œํฌ ์—ฐ๊ฒฐ์ด ๋ถˆ์•ˆ์ •ํ•ด์„œ ๊ทธ๋Ÿฐ๊ฑฐ๋ผ๊ตฌ~ ๊ทธ๋Ÿด ๋•, ์–•์€ ํด๋ก ์„ ํ•ด์„œ ๋ฐ›์•„์•ผ ํ•œ๋‹ค๊ณ  ํ–‡๋‹ค. ๊ทผ๋ฐ ๋‚ด ๊ฒฝ์šฐ์—” ๊ทธ๋ƒฅ ์–•์€ ํด๋ก ์„ ํ•˜๋ฉด ์•ˆ๋˜๊ณ  ํ•œ๋ฒˆ ์••์ถ•ํ•œ ๋‹ด์— ํด๋ก ํ–ˆ์–ด์•ผ ํ–ˆ๋‹ค. ์•„๋ž˜ ์ฝ”๋“œ & ์‚ฌ์ดํŠธ ์ฐธ๊ณ  git config --global core.comp..

[git] fork ํ•œ ์ €์žฅ์†Œ์™€ fetch upstream ์œผ๋กœ ์ตœ์‹ ํ™”ํ•ด์ฃผ๊ธฐ

Forkํ•œ ์ž์‹ ์˜ ๋กœ์ปฌ ์ €์žฅ์†Œ์— remote๋กœ ์›๋ž˜ ์ €์žฅ์†Œ๋ฅผ ๋“ฑ๋กํ•˜๊ณ  ์ตœ์‹ ํ™”ํ•ด์ฃผ๋ฉด ๋œ๋‹ค. 1) ๋“ฑ๋กํ•˜๊ธฐ ์ „์— ํ˜„์žฌ ์›๊ฒฉ ์ €์žฅ์†Œ๊ฐ€ ๋ฌด์—‡์ด ์žˆ๋Š”์ง€ ํ™•์ธํ•ด๋ณด์ž $ git remote -v origin https://github.com/LeeYunSung/beakJoonCodePlus (fetch) origin https://github.com/LeeYunSung/beakJoonCodePlus (push) ํ˜„์žฌ๋Š” ๋‚ด ์›๊ฒฉ ์ €์žฅ์†Œ๋งŒ ๋“ฑ๋ก๋˜์–ด ์žˆ๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค. 2) ์›๊ฒฉ ์ €์žฅ์†Œ์— “upstream”์ด๋ž€ ์ด๋ฆ„์„ ์ฃผ๊ณ  ์›๋ž˜ ์†Œ์Šค ์ €์žฅ์†Œ๋ฅผ ์ถ”๊ฐ€ํ•œ๋‹ค. $ git remote add upstream https://github.com/suengwone/beakJoonCodePlus.git 3) ๋‹ค์‹œ ๋“ฑ๋ก๋œ ์›๊ฒฉ ์ €..

[git] commit์ด git์— ๋ฐ˜์˜๋˜์ง€ ์•Š์„ ๋•Œ ๋Œ€์ฒ˜๋ฒ•

1. git url์— origin์œผ๋กœ ์—ฐ๊ฒฐ๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธํ•˜์ž git remote -v 'origin https://github.com/๊ณ„์ •/๋ ˆํผ์ง€ํ† ๋ฆฌ' ๋ผ๋Š” ๊ฒฐ๊ณผ๊ฐ€ ๋‚˜์™€์•ผ ํ•œ๋‹ค. 2. ์•„๋‹ˆ๋ผ๋ฉด remote์— ๊ณ„์ • ์—ฐ๊ฒฐ์ด ์ž˜ ์•ˆ๋˜์–ด ์žˆ๋Š” ๊ฒƒ์ด๋ฏ€๋กœ ์—ฐ๊ฒฐํ•ด์ฃผ๋ฉด ๋œ๋‹ค. git remote add origin https://github.com/๊ณ„์ •/๋ฆฌํฌ์ง€ํ† ๋ฆฌ 3. ๊ทธ๋ฆฌ๊ณ  ๋‹ค์‹œ pushํ•ด๋ณด๋ฉด OK. [git ๊ณต์‹ reference ์ฐธ์กฐ] Git - ๋ฆฌ๋ชจํŠธ ์ €์žฅ์†Œ ์›๊ฒฉ ์ €์žฅ์†Œ๋ผ ํ•˜๋”๋ผ๋„ ๋กœ์ปฌ ์‹œ์Šคํ…œ์— ์œ„์น˜ํ•  ์ˆ˜๋„ ์žˆ๋‹ค. remote'' ์ €์žฅ์†Œ๋ผ๊ณ  ์ด๋ฆ„์ด ๋ถ™์–ด์žˆ์–ด๋„ ์ด ์›๊ฒฉ ์ €์žฅ์†Œ๊ฐ€ ์‚ฌ์‹ค ๊ฐ™์€ ๋กœ์ปฌ ์‹œ์Šคํ…œ์— ์กด์žฌํ•  ์ˆ˜๋„ ์žˆ๋‹ค. ์—ฌ๊ธฐ์„œ remote'' ๋ผ๋Š” ์ด๋ฆ„์€ ๋ฐ˜๋“œ git-scm.com

[git] pull ์ „์— commit ํ–ˆ์„ ๋•Œ ๋Œ€์ฒ˜๋ฒ•

commit์„ ํ–ˆ๋Š”๋ฐ, pull ๋‚ด์—ญ์ด ๋ณด์ด์ง€ ์•Š์•˜์–ด์„œ pull์„ ๋‹ค ๋ชป๋ฐ›๊ณ  commit์„ ๋จผ์ € ํ–ˆ๋‹ค๋ฉด git ์ถฉ๋Œ์ด ๋‚  ๊ฐ€๋Šฅ์„ฑ์ด ๋งŽ์ฃ . (์•„์ฃผ ๋นˆ๋ฒˆํ•œ ์‹ค์ˆ˜...ํ•˜ํ•˜) ์ด ๋•Œ์˜ ๊ฐ„๋‹จ ํ•ด๊ฒฐ๋ฒ•์„ ์•Œ์•„๋ด…์‹œ๋‹น. ์šฐ์„ , git commit ๋‚ด์—ญ์„ ์ง€์›Œ์ค๋‹ˆ๋‹ค. (์ผ๋‹จ commit ํ•œ ์ƒํƒœ๋‹ˆ๊นŒ ๋‚ด์—ญ ๊ฒ€์ƒ‰์œผ๋กœ ์‚ด๋ฆด ์ˆ˜ ์žˆ์–ด์š”! ๊ฑฑ์ • NoNo) git reset --hard HEAD^ 1) --hard ์˜ต์…˜์€ ๋Œ์•„๊ฐ€๋ ค๋Š” ์ด๋ ฅ์ดํ›„์˜ ๋ชจ๋“  ๋‚ด์šฉ์„ ์ง€์›Œ ๋ฒ„๋ฆฌ๋ฏ€๋กœ ์ปค๋ฐ‹ํ•ด์•ผํ•  ๊ฒƒ๋“ค์ด ์žˆ๋Š”์ง€ ๋‹ค์‹œ ํ•œ ๋ฒˆ ํ™•์ธํ•ด์ฃผ์„ธ์š”. 2) HEAD^๋Š” ๋ฐ”๋กœ ์ง์ „ ์ปค๋ฐ‹ 1๊ฐœ๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๋Ÿฌ๊ฐœ์˜ ์ปค๋ฐ‹์ด๋ผ๋ฉด HEAD~2 (2๊ฐœ), HEAD~3 (3๊ฐœ) ๋“ฑ์˜ ํ‘œํ˜„์„ ์‚ฌ์šฉํ•ด์ฃผ์„ธ์š”. ๋‹ค์Œ์œผ๋กœ ๋ชป ๋ฐ›์€ pull์„ ๋ฐ›์•„์ฃผ์„ธ์š”. git pull ๊ทธ ๋‹ค์Œ gi..

728x90