줄 삭제 : ctrl+u(앞), ctrl+k(뒤)
이전 경로로 이동 : cd -
폴더 생성하면서 그 폴더로 이동 : mkdir 폴더명 && cd $_
파일 2개 이상 생성 : touch 1.txt && touch 2.txt
파일 staging
-- 2개 이상 : git add 1.txt && 2.txt
-- 모두 : git add .
파일 unstaging
-- 새로 생성된 파일일 때 : git rm --cached 1.txt
-- 기존에 있던 파일에 내용을 수정했을 때 : git retore --staged 1.txt
마지막 commit 변경 : git commit --amend -m ""
gitignore
-- touch .gitignore > start .gitignore > 폴더명/, ./*.txt, !test.txt
git diff : 비교 대상이 'work directory' vs '현재 속해 있는 브랜치의 staging area/commit' 비교
-- A 를 커밋 -> B를 Git Add만 함 -> C를 수정하는 상황이라면, C와 B를 비교
git diff HEAD : work directory와 최근 commit 비교
git diff --staged or git diff --cached : 스테이징 영역과 최근 커밋을 비교
git diff branch1...branch2 : 브랜치간 비교
git diff 커밋해시...커밋해시 : 커밋 간 비교
git stash [save] [파일명] "stash를 해두었습니다"git stash pop : 가장 최근 stash 복원git stash apply : 가장 최근 stash 복원하되, stash는 유지git stash list : stash lis 보기git restore <파일명> : 작업 디렉토리의 변경사항을 최신 커밋으로 변경 git restore --staged <파일명> : 스테이징에서 작업디렉토리로 git restore --source 커밋해시값/브랜치이름 <file> : 해당 파일을커밋해시값/브랜치 상태로 원상복구git reset <commit-hash/file/branch/HEAD~1> : default로 --mixed.git reset --hard <commit-hash> : 작업 디렉토리 내용도 지정 커밋 상태로 되돌림git reset --soft <commit-hash> : 파일 변경사항은 stage로 이동git reset --hard ORIG_HEAD : reset 잘못했을 때 취소git revert <취소할 commit-hash/HEAD>