[Git] Commit

im_taehoยท2023๋…„ 1์›” 2์ผ
0
post-thumbnail

๐Ÿšฉ Commit์„ ์ด์šฉํ•ด ๋ณ€๊ฒฝ์‚ฌํ•ญ์„ ๊ธฐ๋กํ•ด ๋ด…์‹œ๋‹ค.

๐Ÿ’ก Commitํ•  ํŒŒ์ผ ๋‹ด๊ธฐ

  • ํŒŒ์ผ ํ•˜๋‚˜ ๋‹ด๊ธฐ
$ git add <ํŒŒ์ผ>
  • ๋ชจ๋“  ํŒŒ์ผ ๋‹ด๊ธฐ
$ git add .

๐Ÿ’ก ํŒŒ์ผ์ด ๋‹ด๊ธด์ง€ ํ™•์ธ

  • $ git status ์‹คํ–‰
  • Changes to be committed: ํ˜„์žฌ ๋ณ€๊ฒฝ์‚ฌํ•ญ(๋ฒ„์ „)์— ๋‹ด๊ธด ํŒŒ์ผ ๋ชฉ๋ก
  • Untracked files: Git์˜ ๊ด€๋ฆฌ์— ์˜ํ–ฅ์„ ๋ฐ›์ง€ ์•Š๊ณ  ์ถ”์ ๋˜์ง€ ์•Š๋Š” ํŒŒ์ผ ๋ชฉ๋ก

  • $ git diff ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•˜์—ฌ ์ž์„ธํ•œ ๋ณ€๊ฒฝ๋‚ด์—ญ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

๐Ÿ’ก Commit ์‹คํ–‰ํ•˜๊ธฐ

  • ๋ฉ”์‹œ์ง€์™€ ํ•จ๊ป˜ Commit ํ•˜๊ธฐ
$ git commit -m "<๋ฉ”์‹œ์ง€>"
  • Commit ๋กœ๊ทธ ํ™•์ธํ•˜๊ธฐ
$ git log

๐Ÿ’ก Commit๊ณผ Add๋ฅผ ํ•œ๊บผ๋ฒˆ์— ์‹คํ–‰ํ•˜๊ธฐ

$ git commit -am "<๋ฉ”์‹œ์ง€>"
  • ๐Ÿšจ ์ƒˆ๋กœ ์ถ”๊ฐ€๋œ(untracked) ํŒŒ์ผ์ด ์—†์„ ๋•Œ๋งŒ ๊ฐ€๋Šฅ
profile
๋ฐ˜๊ฐ‘์Šต๋‹ˆ๋‹ค :)

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