git init
git config --global init.defaultBranch 변경할이름
--global 사용했기 때문에 앞으로 생성되는 모든 기본(master) branch 이름에 적용
git branch -m 변경할 이름
git branch 새로운 브랜치 이름
git checkout -b 새로운 브랜치 이름 -브랜치 생성과 동시에 새로운 브랜치로 이동
git remote add origin 깃허브주소
git push origin 새로운 브랜치 이름
ex) git branch new
git remote add origin 깃허브주소~~~
git push origin new
git status
git add . -현재 파일내의 모든 파일 staging
git add 파일명 - 선택한 파일만 staging
git commit -m "기록 할 내용 입력"
git log
⭐원격 저장소 생성
⭐git remote --v (local 저장소와 연결된 remote저장소가 있는지 확인)
⭐git remote add 원격저장소별칭 생성한원격저장소url
⭐ git remote --v (다시 확인)
원격저장소별칭이 origin이라고 가정할때
⭐ git push origin 브랜치명
git clone 복사url
🌟 git remote add 저장소별칭 다른사람원격저장소주소
🌟git remote -v 로 확인
저장소별칭을 other이라고 정했을 때
🌟 git pull other 상대방이사용하고있는브랜치이름
git reset HEAD^ -가장 최신의 커밋취소
HEAD~3 (최신에서부터 세번째)
HEAD~2=HEAD~1^1 (최신에서 부터 두번째)
HEAD~1=HEAD^ (최신)
git restore --staged file
git rm --cached file
git merge 브랜치명
git checkout branch명 - 브랜치로 이동