git branch
branch ๋ช
๋ น์ด
branch ํ์ธ
# * ํ์๋ก ํ์ฌ ์์
์ค์ธ ๋ธ๋์น ํ์ธ ๊ฐ๋ฅ
git branch
branch ์์ฑ ํ ํด๋น ๋ธ๋์น๋ก ์ ํ
git branch {์์ฑํ๋ ค๋ branch๋ช
}
git checkout -b {์์ฑํ๋ ค๋ branch๋ช
}
git switch -c {์์ฑํ๋ ค๋ branch๋ช
}
branch ์ด๋
git checkout {์ด๋ํ๋ ค๋ branch๋ช
}
git switch {์ด๋ํ๋ ค๋ branch๋ช
}
branch ๋ณํฉ
# merge๋ฅผ ์ํด main ๋ธ๋์น๋ก ์ ํ
git switch main
# main ๋ธ๋์น๋ก feat/todo ๋ธ๋์น๋ฅผ ๋ณํฉ
git merge feat/todo
๋ค๋ง, ์ค์ ํ๋ก์ ํธ ๊ฐ๋ฐ ์์๋ ๋ธ๋์น๋ฅผ ๋ก์ปฌ์์ ํฉ์น๊ธฐ๋ณด๋ค๋ GitHub์ pull request ๊ธฐ๋ฅ์ ์ด์ฉํ์ฌ ๋ณ๊ฒฝ ๋ด์ญ์ ์ถฉ๋ถํ ํ์ธํ๊ณ ๋ ๋ค์์ ๋จธ์งํ๋ ๊ฒฝ์ฐ๊ฐ ๋ ๋ง๊ธฐ ๋๋ฌธ์, ๋ก์ปฌ์์ ๋จธ์งํ์ง ์๊ณ feature ๋ธ๋์น๋ฅผ pushํ์ฌ PR๋ฅผ ์์ฒญํ๋ ๊ฒ์ ๊ถ์ฅ
# GitHub repository๋ก push
git push origin feat/todo
# GitHub์์ Pull Request ๋ฐ merge
branch ์ญ์
# mergeํ ๋ธ๋์น ์ญ์
git branch -d {์ญ์ ํ๋ ค๋ branch๋ช
}
# mergeํ์ง ์์ ๋ธ๋์น ์ญ์
git branch -D {์ญ์ ํ๋ ค๋ branch๋ช
}
branch ๊ด๋ จ ์๋ฌ
๋ธ๋์น๋ฅผ ์ญ์ ํ๋ ค๊ณ ํ ๋ ๋ค์๊ณผ ๊ฐ์ ์๋ฌ๊ฐ ๋์ฌ ์ ์๋ค. ์ด๋ ๋ธ๋์น์์ ์์ ํ ๋ด์ฉ์ merge ํ์ง ์์์ ๋์ค๋ ์๋ฌ์ด๋ค. ๋ฑํ ์์ ๋ด์ฉ์ด ์ค์ํ์ง ์๋ค๋ฉด
git branch -D
๋ฅผ ์ ๋ ฅํด๊ฐ์ ๋ก ๋ธ๋์น๋ฅผ ์ญ์ ํ๋ฉด ๋๋ค.error: The branch 'branchname'isnot fully merged. If you are sure you want todelete it, run 'git branch -D branchname'.
๋ค๋ง ์ ๊ฐ์ ์ญ์ ๋ ์ด๋๊น์ง๋ ๋ก์ปฌ์์ ๋ธ๋์น๋ฅผ ์ญ์ ํ ๊ฒ์ด๋ฏ๋ก ๋ฆฌ๋ชจํธ ์๋ฒ ์์ ๋ธ๋์น๋ ์ญ์ ๋ฅผ ํด์ผ ํ๋ค.
Last updated