.git 파일 생성, 프로젝트 폴더에 git을 심어주는 역할
git init
git add inah.text # inah.text 파일 stage
git add . # 모든 파일 stage
git commit -m "commit message"
git commit -am "add and commit" # 수정한 파일에 add와 commit 동시에 하기
git 원격 저장소에 반영하기
git push origin main
git push
git 원격 저장소의 파일을 최신버전으로 가져오기
git pull origin main
git pull
작업을 진행중인 main branch에서 가지를 나누어 독립적인 작업을 할 때에 사용,
각각의 branch는 다른 branch의 영향을 받지 않는다.
git branch 목록 보기
git branch
git branch <new branch name>
git checkout <branch name>
현재 브랜치에서 새로운 브랜치를 생성 후 이동하기
git checkout -b <new branch name>
브랜치명 변경하기
git branch -m <old branch name> <new branch name>
브랜치 삭제하기
git branch -d <branch name>
저장소에 잘못 반영 되었을 때 (Push) 되돌리기
git reset <option> <commit id>
[1] git log 사용하여 되돌리고 싶은 commit 시점의 id값 찾아내기
[2] git reset <hard><soft><mixed> 44a8
commit은 유지하면서 내용만 rollback,
원격 저장소까지 push가 진행 됐을 때 사용한다.
git revert <commit id>