๐ŸŒŽ Git & GitHub ๊นƒํ—™ ์ •๋ฆฌzip

0713vinยท2023๋…„ 1์›” 10์ผ
26

github

๋ชฉ๋ก ๋ณด๊ธฐ
1/2
post-thumbnail

๐Ÿ’ป Git & GitHub

https://github.com/hbons/git-cheat-sheet

๐Ÿ“Œ ์ž์ฃผ ์‚ฌ์šฉํ•˜๋Š” ๋ช…๋ น์–ด

  • ํ„ฐ๋ฏธ๋„ ๋ช…๋ น์–ด
๋ช…๋ น์–ด๋œป์„ค๋ช…ํ™œ์šฉ
cdchange directoryํด๋”์ด๋™cd (๊ฒฝ๋กœ) โ†’ย .ย ..ย /usr
lslist segmentsํ˜„์žฌ ๊ฒฝ๋กœ ๋‚ด ํŒŒ์ผ ๋ชฉ๋ก ์ถœ๋ ฅls -al
pwdprint working directoryํ˜„์žฌ ๊ฒฝ๋กœ ์ถœ๋ ฅ
mkdir / rmdirmake directory๋””๋ ‰ํ† ๋ฆฌ ์ƒ์„ฑ / ์ œ๊ฑฐ
rmremoveํŒŒ์ผ / ๋””๋ ‰ํ† ๋ฆฌ ์ œ๊ฑฐrm -rf
cpcopyํŒŒ์ผ / ๋””๋ ‰ํ† ๋ฆฌ ๋ณต์‚ฌ
mvmoveํŒŒ์ผ / ๋””๋ ‰ํ† ๋ฆฌ ์ด๋™
catconcatenateํ„ฐ๋ฏธ๋„์— ํŒŒ์ผ ๋‚ด์šฉ ์ถœ๋ ฅ
touchtouchํŒŒ์ผ ์ƒ์„ฑ ๋ฐ ๋‚ ์งœ์ •๋ณด ๋ณ€๊ฒฝtouch readme.md
chmodchange modeํŒŒ์ผ / ๋””๋ ‰ํ† ๋ฆฌ ๊ถŒํ•œ ์„ค์ •chmod u+x readme.md

๐Ÿ“Œ Git์˜ ๋ชฉ์ ๊ณผ ํ•„์š”์„ฑ

  1. ๋ฒ„์ „ ์ปจํŠธ๋กค ์‹œ์Šคํ…œ
  2. ์–ด๋–ค ํ”„๋กœ๊ทธ๋žจ์„ ์ˆ˜์ •, ๊ฐœ์„ ํ•˜์—ฌ ์™„์„ฑํ•œ ๊ฒƒ
  3. ์ด์ „๊ณผ ์•ฝ๊ฐ„์”ฉ ๋‹ค๋ฅธ ๋ณ€ํ™”๋“ค์„ ๊ตฌ๋ถ„ํ•˜๋Š” ํ‘œ์‹œ
    1. ์ˆ˜์ •ํ•  ๋•Œ ๋งˆ๋‹ค ํŒŒ์ผ์„ ์ƒˆ๋กœ ๋งŒ๋“ค๋ฉด ๊ด€๋ฆฌ๊ฐ€ ๋ถˆํŽธ
    2. โœจย ์–ธ์ œ๋“  ์ด์ „ ๋ฒ„์ „์˜ ์ฝ”๋“œ๋กœ ๋Œ์•„๊ฐˆ ์ˆ˜ ์žˆ์Œ
    3. โœจย ์–ด๋–ค ๊ฐœ๋ฐœ์ž๊ฐ€ ์–ด๋–ค ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ–ˆ๋Š”์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค
    4. ํ•˜๋‚˜์˜ ํ”„๋กœ์ ํŠธ๋ฅผ ๋‘๊ณ  ์—ฌ๋Ÿฌ๋ช…์ด ๊ฐœ๋ฐœ์ž๋“ค์ด ํ˜‘์—…ํ•  ์ˆ˜ ์žˆ๋‹ค

๐Ÿ“Œ Github ์™€ Git์˜ ์ฐจ์ด์ 

  1. Git git์„ ์‚ฌ์šฉํ•œ ํ”„๋กœ์ ํŠธ๋“ค์˜ ์ €์žฅ์†Œ
  2. ๊ฐœ๋ฐœ์ž๋“ค์˜ Social Network
  3. Git ํ”„๋กœ์ ํŠธ์˜ ๋ฒ„์ „๊ด€๋ฆฌ๋ฅผ ๋„์™€์ฃผ๋Š” ์‹œ์Šคํ…œ
  4. GitHub โ†’ Git์„ ์ด์šฉํ•ด ๋ฒ„์ „๊ด€๋ฆฌ๋ฅผ ํ•œ ํ”„๋กœ์ ํŠธ๋“ค์„ ๊ด€๋ฆฌํ•˜๊ฒŒ ํ•ด์ฃผ๋Š” ํ˜ธ์ŠคํŠธ ์„œ๋น„์Šค

๐Ÿ“Œ Git cheat sheet

๋ช…๋ น์–ด๋œป์„ค๋ช…ํ™œ์šฉ
git clone๊นƒ ๋ณต์ œ์‹ ๊ทœ repository๋ฅผ ๋‚ด ๋กœ์ปฌ๋กœ ๊ฐ€์ ธ์˜ค๊ธฐgit clone [%ropo link%]
git branch๋…๋ฆฝ๋œ ๊ฐœ๋ฐœ ๊ณต๊ฐ„ ์ƒ์„ฑ๊ฐœ๋ฐœ์ž, ํŒŒ๋“œ ๋ณ„๋กœ ๋ธŒ๋žœ์น˜๋ฅผ ์‚ฌ์šฉํ•ด์•ผํ•จ
- e.g. main ํŒŒํŠธ ๊ฐœ๋ฐœ์ž๋Š” main ๋ธŒ๋žœ์น˜๋ฅผ ์‚ฌ์šฉ
- e.g. log-in ํŒŒํŠธ ๊ฐœ๋ฐœ์ž๋Š” log-in ๋ธŒ๋žœ์น˜๋ฅผ ์‚ฌ์šฉ
git branch [branch name]
git checkout๋ธŒ๋žœ์น˜๋ฅผ ์ด๋™ํ˜„์žฌ โ†’ ์ด๋™ํ•  ๋ธŒ๋žœ์น˜git checkout [branch name]
git checkout -b๋ธŒ๋žœ์น˜ ์ƒ์„ฑ๊ณผ ํ•จ๊ป˜ ํ•ด๋‹น ๋ธŒ๋žœ์น˜๋กœ checkout์ƒ์„ฑ ๋ฐ ๋ธŒ๋žœ์น˜ ์ด๋™git checkout -b [branch]
git pull(์ด๋ฏธ ์กด์žฌํ•˜๋Š” repo) ์ฝ”๋“œ ๊ฐ€์ ธ์˜ค๊ธฐGitHub์˜ ํŠน์ • ๋ธŒ๋žœ์น˜์˜ ์ฝ”๋“œ๋ฅผ ๊ฐ€์ ธ์˜ฌ ๋•Œ ์‚ฌ์šฉgit pull origin [branch name]
git merge์ฝ”๋“œ ํ•ฉ์น˜๊ธฐ๋กœ์ปฌ์—์„œ ํ˜„์žฌ ๋ธŒ๋žœ์น˜์˜ ์ฝ”๋“œ์™€ ํŠน์ • ๋ธŒ๋žœ์น˜์˜ ์ฝ”๋“œ๋ฅผ ํ•ฉ์น  ๋•Œ ์‚ฌ์šฉgit merge [branch name]
git pullGitHub์—์„œ ๊ฐ€์ ธ์˜ฌ ๋ธŒ๋žœ์น˜ ์ด๋ฆ„GibHub Master โ†’ Local Mastergit pull [branch]
git stashgit ์ž„์‹œ์ €์žฅ๋ธŒ๋žœ์น˜ ์ด๋™์„ ์œ„ํ•œ ์ž„์‹œ์ €์žฅgit stash
git stash show -p
git apply -R
stash ๋˜๋Œ๋ฆฌ๊ธฐstash๋ฅผ ๋˜๋Œ๋ฆฐ๋‹คgit stash show -p,
git apply -R
git remote -vgit remote Ref ์กฐํšŒ์—ฐ๊ฒฐ ๋˜์–ด์žˆ๋Š” ์›๊ฒฉ ๋ ˆํŒŒ์ง€ํ† ๋ฆฌ ํ™•์ธgit remote -v
git remote remove origin์—ฐ๊ฒฐ ๋˜์–ด์žˆ๋Š” ์›๊ฒฉ ๋ ˆํŒŒ์ง€ํ† ๋ฆฌ ์‚ญ์ œ์—ฐ๊ฒฐ ๋˜์–ด์žˆ๋Š” ์›๊ฒฉ ๋ ˆํŒŒ์ง€ํ† ๋ฆฌ ์‚ญ์ œgit remote remove origin

๐Ÿ“Œ Git์˜ init, add, status, commit, log, push ๋ช…๋ น์–ด์˜ ์—ญํ• 

  1. git init โ†’ git ์ €์žฅ์†Œ ์ƒ์„ฑ / ๋ฒ„์ „ ๊ด€๋ฆฌ๋ฅผ ์œ„ํ•œ ์ •๋ณด ์ƒ์„ฑ
    • ๋ฒ„์ „๊ด€๋ฆฌ๋ฅผ ํ•˜๊ณ ์‹ถ์€ ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ํ•ด๋‹น ๋ช…๋ น์–ด ์ž…๋ ฅ
    • ํ•ด๋‹น git ์— ์ ‘๊ทผํ•˜์—ฌ ์ค‘์š”ํ•œ ์ •๋ณด๋ฅผ ํ‘ธ์‹œ ํ•˜์ง€ ์•Š๋„๋ก ์ฃผ์˜
  2. git add โ†’ ํŒŒ์ผ ์ˆ˜์ • ์ด๋ ฅ ๊ธฐ๋ก ์ค€๋น„ e.g. ์žฅ๋ฐ”๊ตฌ๋‹ˆ
    • ์ˆ˜์ •ํ•œ ํŒŒ์ผ์˜ ์ด๋ ฅ์„ ๋‚จ๊ธธ ์ค€๋น„๋ฅผ ํ•˜๋Š” ๋ช…๋ น์–ด
    • git add [ํŒŒ์ผ์ด๋ฆ„] ํŠน์ • ํŒŒ์ผ ์ด๋ ฅ์„ ๋‚จ๊ธฐ๊ณ  ์‹ถ์„ ๋•Œ
    • git add . ๋ณ€๊ฒฝ๋œ ํŒŒ์ผ์˜ ์ „์ฒด ์ด๋ ฅ์„ ๋‚จ๊ธฐ๊ณ  ์‹ถ์„ ๋•Œ
  3. git status โ†’ ์ƒํƒœ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋Š” ๋ช…๋ น์–ด
    • ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ์ผ์–ด๋‚˜๊ณ  ์žˆ๋Š” ์ƒํƒœ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋Š” ๋ช…๋ น์–ด
  4. commit โ†’ ํŒŒ์ผ ์ˆ˜์ • ์ด๋ ฅ ๊ธฐ๋ก e.g. ์ฃผ๋ฌธํ•˜๋Š” ๊ฒƒ add โ†’ commit
    • git commit -m โ€œmsgโ€ ํ•œ์ค„๋กœ ์ปค๋ฐ‹ ๋ฉ”์„ธ์ง€๋ฅผ ๋‚จ๊ธธ ๋•Œ
    • git commit ์—ฌ๋Ÿฌ์ค„์˜ ์ปค๋ฐ‹์„ ๋‚จ๊ธธ ๋•Œ
  5. log โ†’ e.g.์˜์ˆ˜์ฆ
    • ๊ธฐ๋ก ์—ด๋žŒ์šฉ
  6. push
    • ์ž‘์„ฑํ•œ ์ฝ”๋“œ๋ฅผ ์›๊ฒฉ ์ €์žฅ์†Œ์— ์—…๋กœ๋“œ
    • ์ด๋ ฅ์„ ๋‚จ๊ธด ์ฝ”๋“œ๋ฅผ ๊นƒํ—ˆ๋ธŒ์— ์˜ฌ๋ฆฌ๊ณ  ์‹ถ์„ ๋•Œ ์‚ฌ์šฉํ•˜๋Š” ๋ช…๋ น์–ด
    • git push origin [branch-name]

๐Ÿ”ข ํ„ฐ๋ฏธ๋„์„ ์‚ฌ์šฉํ•œ ๊นƒ ํ—ˆ๋ธŒ ์—…๋กœ๋“œ ์ˆœ์„œ

  1. GitHub ๋กœ์ปฌ repository ์ƒ์„ฑ
    • + ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ ์ƒˆ๋กœ์šด repository๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
      • README.MD ์—†์ด ์ƒ์„ฑ ํ•ฉ๋‹ˆ๋‹ค.
      • README.MD๊ฐ€ ์—†๋Š” ๊ฒฝ์šฐ
      • โ€ฆor create a new repository on the command line ์„น์…˜์—์„œ 6 git remote add origin https://github.com/%UserName%/%New repo%๋ฅผ ๋ณต์‚ฌํ•˜์—ฌ ํ„ฐ๋ฏธ๋„์— ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.
  2. git init
  3. git add .
  4. git commit (๊ณต์‹์ ์œผ๋กœ ๊ธฐ๋ก ๋‚จ๊น€/์—…๋กœ๋“œ ํ•ฉ๋‹ˆ๋‹ค)
  5. git push origin (branch name)


pwd
//ํ˜„์žฌ ๊ฒฝ๋กœ ์ถœ๋ ฅ

cd git
//ํด๋”์ด๋™

mkdir git
//๋””๋ ‰ํ† ๋ฆฌ ์ƒ์„ฑ

ls
//ํ˜„์žฌ ๊ฒฝ๋กœ ๋‚ด ํŒŒ์ผ ๋ชฉ๋ก ์ถœ๋ ฅ

๐Ÿ’ก ls -al
//ํ˜„์žฌ ๊ฒฝ๋กœ ๋‚ด ํŒŒ์ผ ๋ชฉ๋ก ์ถœ๋ ฅ
//์ค‘์š”ํ•œ ๋ณด์•ˆ์ด๋‚˜ ์ •๋ณด๊ฐ€ ์ž…๋ ฅ์—ฌ๋ถ€๋ฅผ ํ•„ํžˆ ํ™•์ธํ•ด์•ผํ•จ

touch.md %file Name%.md
//md ์ƒ์„ฑ

i
//md ํŒŒ์ผ์— insert ์ƒํƒœ๋กœ ์ „ํ™˜ ํ›„ ์ž…๋ ฅ
:wq
//mdํŒŒ์ผ์„ ์ €์žฅํ•˜๊ณ  ๋‚˜๊ฐ€๊ธฐ

git status

gid add .

git remote add origin https://github.com/%username%/%repo%
git remote
git remote --v

git push origin main

//branch ํ™•์ธ
origin	https://github.com/%username%/%repo% (fetch)
origin	https://github.com/%username%/%repo% (push)
git branch * main

๐Ÿ” Vscode ์—์„œ ํ„ฐ๋ฏธ๋„์„ ์—ด์–ด๋ณด์ž!

  • Cmd + J

๐Ÿ“Œย Git Repo๋ฅผ ํ„ฐ๋ฏธ๋„์„ ์ด์šฉํ•˜์—ฌ clone

cd desktop
//ํด๋”์ด๋™ ๋ฃจํŠธ์—์„œ ๋ฐ์Šคํฌํƒ‘์œผ๋กœ
pwd
//์–ด๋Š ์œ„์น˜์ธ์ง€ ํ™•์ธ ํ•˜๊ธฐ
git clone https://github.com/%repolink%reponame.git
//๊นƒํ—ˆ๋ธŒ์˜ repository ๋งํฌ๋ฅผ ๋„ฃ์Šต๋‹ˆ๋‹ค
Cloning into '%Repo%'...
... [๋‹ค์šด๋กœ๋“œ]
//๋‹ค์šด๋กœ๋“œ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค

๐Ÿ“Œย git clone

  • ์ฝ”๋“œ ๋ณต์ œ (์‹ ๊ทœ | ๋‚ด ๋กœ์ปฌ์— ์—†๋‹ค๋Š” ์ „์ œ)
  • ๊ธฐ์กด repository๋ฅผ ๋‚ด ๋กœ์ปฌ๋กœ ๊ฐ€์ ธ์˜ค๋Š” ๋ช…๋ น์–ด
  • git clone [%ropo link%]

๐Ÿ“Œย git branch

  • ๋…๋ฆฝ๋œ ๊ณต๊ฐ„ ๋งŒ๋“ค๊ธฐ
  • ๋…๋ฆฝ์ ์œผ๋กœ ๊ฐœ๋ฐœ์„ ํ•  ์ˆ˜ ์žˆ๋Š” ๊ณต๊ฐ„์„ ๋งŒ๋“œ๋Š” ๋ช…๋ น์–ด
  • git branch [branch name]
  • ๋ชจ๋‘ main/master ๋ธŒ๋žœ์น˜๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด ์ฝ”๋“œ๊ฐ€ ๊ผฌ์ด๊ฒŒ ๋จ
  • ์œ„์˜ ์ด์œ ๋กœ, ๊ฐœ๋ฐœ์ž ๋งˆ๋‹ค ๊ฐœ๋ณ„์˜ ๋ธŒ๋žœ์น˜์—์„œ ์ž‘์—…ํ•ด์•ผํ•จ
    • e.g. main ํŒŒํŠธ ๊ฐœ๋ฐœ์ž๋Š” main ๋ธŒ๋žœ์น˜๋ฅผ ์‚ฌ์šฉ
    • e.g. log-in ํŒŒํŠธ ๊ฐœ๋ฐœ์ž๋Š” log-in ๋ธŒ๋žœ์น˜๋ฅผ ์‚ฌ์šฉ

๐Ÿ“Œย git checkout

  • ๋ธŒ๋žœ์น˜๋ฅผ ์ด๋™ํ•  ๋•Œ ์‚ฌ์šฉ
  • ํ˜„์žฌ ์žˆ๋Š” ๋ธŒ๋žœ์น˜์—์„œ ๋‹ค๋ฅธ ๋ธŒ๋žœ์น˜๋กœ ์ด๋™ํ•  ๋•Œ ์‚ฌ์šฉํ•˜๋Š” ๋ช…๋ น์–ด
  • git checkout [branch name]
  • git branch์™€ ๋‹ค๋ฅธ ๊ฐœ๋… โ†’ ํ•„ํžˆ checkout ํ•ด์ฃผ์–ด์•ผ ํ•จ!
    • ๐Ÿฏ git checkout -b [branch] ์ƒ์„ฑ๊ณผ ๋™์‹œ์— ์ฒดํฌ์•„์›ƒ ๊ฐ€๋Šฅ

๐Ÿ“Œย git pull

  • ์ฝ”๋“œ ๊ฐ€์ ธ์˜ค๊ธฐ (์ด๋ฏธ ์กด์žฌํ•˜๋Š” repository)
    • ๊นƒํ—ˆ๋ธŒ ๋งˆ์Šคํ„ฐ๋ฅผ โ†’ ๋กœ์ปฌ ๋งˆ์Šคํ„ฐ๋กœ ๊ฐ€์ ธ์˜ค๊ธฐ
  • github์— ์žˆ๋Š” ํŠน์ • ๋ธŒ๋žœ์น˜์˜ ์ฝ”๋“œ๋ฅผ ๋กœ์ปฌ๋กœ ๊ฐ€์ ธ์˜ฌ ๋•Œ ์‚ฌ์šฉํ•˜๋Š” ๋ช…๋ น์–ด
    • git clone : ์ƒˆ๋กœ์šด/๋กœ์ปฌ์— ์กด์žฌํ•˜์ง€ ์•Š๋Š” ์ „์ฒด ์ฝ”๋“œ๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ๊ฒƒ
  • git pull origin [branch name]
    • ๊นƒํ—ˆ๋ธŒ์—์„œ ๋”ฐ์˜ค๊ณ  ์‹ถ์€ ๋ธŒ๋žœ์น˜ ์ด๋ฆ„
    • ๐Ÿฏ git pull [branch] ํ’€ ๋ธŒ๋žœ์น˜๋ช… ์ƒ๋žต์€ ์ง€์–‘... ์˜ˆ๊ธฐ์น˜ ๋ชปํ•œ ์˜ค๋ฅ˜๋ฅผ ์•ผ๊ธฐ!

๐Ÿ“Œย git merge

  • ์ฝ”๋“œ ํ•ฉ์น˜๊ธฐ
  • ๋กœ์ปฌ์—์„œ ํ˜„์žฌ ๋ธŒ๋žœ์น˜์˜ ์ฝ”๋“œ์™€ ํŠน์ • ๋ธŒ๋žœ์น˜์˜ ์ฝ”๋“œ๋ฅผ ํ•ฉ์น  ๋•Œ ์‚ฌ์šฉ
  • ๋‚˜์˜ ํ˜„์žฌ ์œ„์น˜ ๋ธŒ๋žœ์น˜์—์„œ ๋‹ค๋ฅธ ๋ธŒ๋žœ์น˜๋ฅผ ํ•ฉ์น  ๋•Œ
  • git merge [branch name]
  • ๋‚ด ๋ธŒ๋žœ์น˜์™€ ๊นƒํ—ˆ๋ธŒ์˜ ์ฝ”๋“œ ๋ณ‘ํ•ฉ
  • PR ํ•˜๋‹จ์— ์ปจํŽŒ ์ดํ›„ merge๋ฒ„ํŠผ์ด ํ™œ์„ฑํ™” ๋จ
    • ์ œ์•ฝ์ด ์žˆ์Œ
    • github์—์„œ๋Š” merge ๋จธ์ง€๋‹ด๋‹น์ž๊ฐ€ ๋”ฐ๋กœ ์žˆ์Œ

๐Ÿ“Œย git stash

  • ๐Ÿ—‚๏ธ ์ž‘์—…๋ฌผ ์ž„์‹œ ์ €์žฅํ•  ์ˆ˜ ์žˆ๋Š” ๋ช…๋ น์–ด
  • ์™„๋ฃŒํ•˜์ง€ ์•Š์€ ์ž‘์—…์„ commitํ•˜์ง€ ์•Š๊ณ  ๋‹ค์‹œ ๊บผ๋‚ด์™€ ๋งˆ๋ฌด๋ฆฌ ํ•  ์ˆ˜ ์žˆ์Œ
  • โš ๏ธ stash ์ดํ›„ ์ง„ํ–‰ํ•˜๋Š” ์ž‘์—…์— ๋”ฐ๋ผ ์ž‘์—…๋ฌผ์ด ์—ฐ๋™๋˜๊ฑฐ๋‚˜, ์‚ญ์ œ๋  ์ˆ˜ ์žˆ์œผ๋‹ˆ ์ฃผ์˜ ํ•„์š”.

๐Ÿ™…โ€โ™€๏ธย Master(Main) ์ž‘์—…์€ ์ง€์–‘!

  • Master(Main)๊ฐ€ ๊ธฐ๋‘ฅ
  • Master(Main)๋ฅผ ๊ธฐ์ค€์œผ๋กœ branch๊ฐ€ ํ™•์žฅ ๋˜์–ด์•ผ ํ•จ
  • Vscode ์ขŒ์ธก ํ•˜๋‹จ์— ํ™•์ธ ๊ฐ€๋Šฅ
  • branch ์ˆ˜์‹œ๋กœ ํ™•์ธ!
  • ๋ฐฐํฌํ•  ๋•Œ ๋งˆ์Šคํ„ฐ ์ฝ”๋“œ๋กœ ์ง„ํ–‰๋˜๊ธฐ ๋•Œ๋ฌธ์— ์ž‘์—… ๐Ÿ™…โ€โ™€๏ธ
git branch BranchName/foloderName
git branch BranchName/foloderName
* master //ํ˜„์žฌ ๋‚ด๊ฐ€ ์žˆ๋Š” ๋ธŒ๋žœ์น˜

git checkout BranchName/foloderName
//๋ธŒ๋žœ์น˜๋กœ ์ด๋™
//์ƒ์„ฑํ–ˆ๋‹ค๊ณ  ํ•ด์„œ ๋ฐ”๋กœ ๊ทธ ๋””๋ ‰ํ† ๋ฆฌ/๋ธŒ๋žœ์น˜๋กœ ์ด๋™ํ•˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ
//์–ด๋–ค ์ž‘์—…์„ ํ• ๊ฒƒ์ธ์ง€์— ๋”ฐ๋ผ 'feature' ๋ฅผ fix๋กœ ๋ฐ”๊พธ์–ด์„œ ๋ณ€๋™
//feature/ ์ž‘์—…ํ•  ๊ธฐ๋Šฅ
git checkout BranchName/foloderName
//Switched to branch 'BranchName/foloderName'
git add .

git commit -m "ADD:md ํŒŒ์ผ์ƒ์„ฑ "
//ADD:md ํŒŒ์ผ์ƒ์„ฑ

git push origin BranchName/foloderName

git push origin BranchName/foloderName

git checkout master
//Switched to branch 'master'
//Your branch is behind 'origin/master' by 2 commits, and can be fast-forwarded.
git pull origin master
git checkout BranchName/foloderName

Switched to branch 'feature/testfile'
//๋‚ด ๋งˆ์Šคํ„ฐ๋ฅผ ๊ฐ€์ ธ์™€์„œ ๋กœ์ปฌ์— ๋จธ์ง€ ํ•  ๊ฒƒ

Origin ๋กœ์ปฌ์—์„  ์‚ฌ์šฉ X | Origin์€ ๊นƒํ—ˆ๋ธŒ์˜ ๋งํฌ๋ฅผ ๋Œ€์‹ ํ•˜๋Š” ๊ฒƒ์ด๊ธฐ ๋•Œ๋ฌธ


์ถœ์ฒ˜:

profile
๐ŸŒŽ Code up a better world! ๐Ÿ‘ฉโ€๐ŸŽจ ๊ทธ๋ž˜ํ”ฝ ๋””์ž์ด๋„ˆ โ†’ ํ”„๋ก ํŠธ์—”๋“œ ๊ฐœ๋ฐœ์ž๐Ÿ‘ฉโ€๐Ÿ’ป

4๊ฐœ์˜ ๋Œ“๊ธ€

comment-user-thumbnail
2023๋…„ 1์›” 19์ผ

์ž˜ ์ •๋ฆฌ๋œ ์ข‹์€ ๊ธ€์ด๋„ค์š”!
ํ„ฐ๋ฏธ๋„์„ ์‚ฌ์šฉํ•œ ๊นƒ ํ—ˆ๋ธŒ ์—…๋กœ๋“œ ์ˆœ์„œ์— ์˜คํƒ€๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค!
li -> ls
:qw ->:wq

1๊ฐœ์˜ ๋‹ต๊ธ€
comment-user-thumbnail
2023๋…„ 1์›” 20์ผ

์ข‹์€ ๊ธ€์ด๋„ค์š”
git pull ์นดํ…Œ๊ณ ๋ฆฌ๊ฐ€ ๋‘๊ฐœ ์ž…๋‹ˆ๋‹ค. ๐Ÿ‘€

1๊ฐœ์˜ ๋‹ต๊ธ€