git branch <branch_name>
git checkout <branch_name>
git switch <branch_name>
브랜치 A에서 브랜치 B로 전환할 때, A에서 작업했던 내용은 git add 및 git commit 까지 해줘야한다. 그렇지 않으면 작업내용이 전환된 브랜치(B)까지 옮겨간다.
git reset --hard [commit_ID]
commit_ID로 HEAD를 바꿔주고, 이 이후에 했던 commit들은 제거한다.
git revert [commit_ID]
commit_ID 내용으로 새로운 commit을 작성하여 HEAD를 위치시키고, commit 이력은 제거하지 않는다.
브랜치 A와 B를 병합시킬 때,
git merge [branch_name]
병합 시에 충돌이 생기면 해당 파일 내용에 로그가 생기고, 이것들을 수정해준 뒤
git add
git commit
해주면됨.
git branch -d [branch_name]
누구나 쉽게 이해할 수 있는 Git 입문 https://backlog.com/git-tutorial/kr/stepup/stepup2_6.html