Git Command
자주 쓰는 git 명령어들에 대해 정리해두겠다.
git switch
1
2
$ git switch feat/first
'feat/first' 브랜치로 전환한다.
1
2
$ git switch -c feat/new
새로 만든 'feat/new' 브랜치로 전환한다.
git restore
1
2
$ git restore app.js
app.js 파일 수정한 것을 복원시킨다.
1
2
$ git restore --staged app.js
이미 git add 로 staged 된 app.js 파일 수정사항 들을 복원시킨다.
git merge
1
2
$ git merge feat/first
현재 브랜치(만약 master)으로 feat/first의 commit 들을 merge 시킨다.
my routine
1
2
3
4
$ git status
$ git add .
$ git commit -m "feat: blahblah"
$ git push origin feat/first(현재 branch)
원격 저장소 branch들 가지고 오기
1
2
3
4
$ git remote update
$ git branch -a
$ git switch -c (new branch) origin/branchname
origin/branchname의 commit 을 들고있는 로컬 브랜치 (new branch)를 만든다.
로컬 branch 지우기
1
$ git branch -d (branchname)
현재 branch commit 기록 보기
1
$ git log //계속 Enter 치면서 다음 페이지 넘어가고 q누르면 나옴.
This post is licensed under CC BY 4.0 by the author.