Git 명령어

류호익·2021년 1월 11일
0

git

목록 보기
1/1
post-thumbnail

Git 의 명령어 종류에 대해 알아보자

  1. git set up
  • 모든 설정 확인
    git config --list

  • 모든 설정을 파일 확인
    git config --global -e

텍스트 에디터 연결 가능!!

  • vs코드 열기 (vscode 설정해야됨)
    code .

  • vs코드 열고 터미널이 vs코드가 닫힐때 까지 변경불가
    config -- global core.editor "code --wait"

  • 사용자 이름 설정
    git config user.name "이름"

  • 사용자 이메일 설정
    git config user.email "이메일"

  • 에디터에서 새로운 줄바꿈 할때 들어가는 문자열
    window에선 /r/n mac에선 /n
    운영체제에 따라 줄바꿈이 다르게 일어나 git history나 git blame을 보기에 문제가 있을수 있어 이것을 수정할 수 있게 할 수 있는 속성
    window에선 true mac에선 input
    git config --global core.autocrlf input or true

  • 초기화(생성)
    git init

  • 모든 리스트보기
    ls -al

  • 숨겨진 파일 빼고 보기
    ls

  • git 파일 구성보기
    open .git

  • 깃 삭제하기
    rm -rf .git

  • 깃 상태확인
    git status

  • 깃 단축키 설정
    git config --global alias.st status
    ex) git status -> git st 변경

  • 명령어에 대한 속성리스트
    git 명령어 --h
    ex) git config --h


git workflow

working directory -> staging area -> .git directory

working directiory는 untracked 와 tracked로 나누어지며
untracked된 파일을 tracked하고싶으면 git add

git add된 것들은 staging area로 복사되어 옮겨진다.
staging 되었지만 파일이 수정되면 working directiory에서 tracked 된 것으로 분류되어 진다.

git branch -> git add -> git commit -> git push
와 같다


  • staging area에서 파일 빼기
    git rm --cached

  • working directory 수정된 내용 확인
    git diff

  • staging area 수정된 내용 확인
    git diff -staged
    git diff -cached

  • 버전 생성
    git commit

  • history 확인
    git log

profile
There's more to do than can ever be done

0개의 댓글