TIL(22.05.05)

김부건·2022년 5월 5일
0
post-thumbnail

git branch 이동

  • git switch [-c] branch_name
  • git checkout [-b] branch_name

둘다 깃 branch를 이동할때 쓰이며, switch는 -c 옵션을, checkout은 -b 옵션을 통해서 branch를 생성하면서 이동이 가능

git switch vs git checkout

git branch 관련명령어

  • git branch --all: remote의 모든 branch 확인
  • git branch --merged: merged된 상태의 브랜치만 확인
  • git branch --no-merged: merged되지 않은 상태의 브래치만 확인
  • git branch -d branch_name: local의 branch 제거
  • git push origin --delete branch_name: local에서 제거한 branch를 remote에 반영
  • git branch --move current_name new_name: branch 이름 변경
  • git push --set-upstream origin new_branch_name: remote의 branch이름 변경 반영
  • git log master..branch_name: master branch와 원하는 branch사이의 log 확인

좀더 git이 익숙해지면 활용해보기 좋은 명령어

  • git blame
  • git bisect [good|bad|reset]
  • git reset --hard HEAD: local에서 작업한 내용 초기화

회고

local에서 작업을 할때, 스스로 너무 지저분하게 작업하고 있는 것에 대해 반성을 한다. git의 branch기능을 이용해서 기능 단위별로 잘 나누고, 필요에 따라서는 commit도 잘게 나눌 필요가 있다고 생각이 들었다. 특정 기능을 구현하는 중에 막히게 되면, 따른 기능을 구현하려고 하는 경향이 있는데, 하나의 branch에서 작업하는 습관을 고치려고 노력해봐야 겠다.😩
또, lint 등의 프로젝트 foundation?을 잡아두고 협업을 하고 있는 것은 처음인데, 팀원들과 어느정도 형태는 비슷해져서 좋은데 아직 내가 너무 익숙하지 못해서 많이 벅차다.😭😭

0개의 댓글