소프트웨어 아키텍처/Linux
git 변경사항 커밋 전에 수정/취소하기
bluefriday
2021. 9. 23. 19:28
반응형
Git 을 사용하여 작업을 진행할 때, 변경된 사항을 앚기 commit 하지 않고 다시 원래 상태로 돌리고 싶은 경우 아래의 명령어를 사용할 수 있다.
git reset
git checkout .
git clean -dfx
명령줄의 내용 중 clean 명령의 경우 다음과 같이 d, f, x 플래그를 같이 주면 현재 추적되어 있는 파일들을 제외하고 (ignore 처리된 파일까지) 모든 파일을 삭제해준다.
root@localhost:~# git clean -h
usage: git clean [-d] [-f] [-n] [-q] [-e <pattern>] [-x | -X] [--] <paths>...
-q, --quiet do not print names of files removed
-n, --dry-run dry run
-f, --force force
-d remove whole directories
-e, --exclude <pattern>
add <pattern> to ignore rules
-x remove ignored files, too
-X remove only ignored files