2022.04.01

Git 명령어

  • commit 내역 확인
    $ git log
    $ git log --pretty=oneline
    $ git lg
    사용방법: git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"
  • git mv
    $ #파일 이동 명령어인 mv을사용하면 rename과 동일한 효과를 얻을 수 있다
    $ git mv <oldName> <newName>
    $ git status (이름 변경됐는지 확인 후) git commit
  • git restore
    $ vi <fileName> 문서내용을 수정한다
    $ git status 
    $ # use "git restore <file>..." to discard changes in working directory
    $ git restore <fileName> or 전체 변경사항을 다 취소하고 싶을때는 git restore .
  • git restore --staged
    $ vi <fileName> 문서내용을 수정한다
    $ git add <fileName>
    $ git status
    $ # use "git restore --staged <file>..." to unstage
    $ git restore --staged <fileName>
    $ git status 를 해보면 스테이지에서 내려간걸 볼 수 있을 것이다
  • git commit -am
    $ # 스테이징과 커밋을 한번에 처리하는 명령어
  • git commit --amend
    $ # 직전의 커밋을 다시 열어서 수정하는 방법
  • git revert --no-commit HEAD~3..
    $ # 여러 커밋을 한꺼번에 돌리고 싶을 때

'프론트엔드 > Git&GitHub' 카테고리의 다른 글

Git remote  (0) 2022.07.11
Github fork  (0) 2022.04.04
.gitignore  (0) 2022.04.03
Git Branch와 Git Flow  (0) 2022.04.02
Git clone과 Git init  (0) 2022.04.01

+ Recent posts