깃 브랜치 사용법
git switch -C {branchname}
: branch 생성 후 이동
- 작업하기
- add, commit
git switch master
, git merge origin {branchname}
어쩌다 삭제된 파일들 복구 방법
git fsck
: 데이터베이스의 Integrity 검사 → dangling 부분이 잃어버린 부분
git branch {브랜치명} {잃어버린 부분 해시값}
: 브랜치에 내용을 복구해줌.
git branch 삭제 후 github에 남아있을 때
git push -d origin {삭제한 브랜치명}
git branch -al
: 깃 브랜치 확인(로컬과 원격 모두)
git branch에서 pull request하면 다른 branch에서 behind 1 commit이 뜨는 문제(?) 해결방법
- behind branch에서
git merge {앞에 있는 branch}
git push origin {behind branch}
출처
This branch is n commits behind master