질문
나는 명령을 사용하여 파일을 실수로 실수로 추가했습니다.
git add myfile.txt
나는 아직 Git Commit을 실행하지 않았습니다.이 파일을 취소하는 방법이 있습니까? 따라서 이러한 파일은 커밋에 포함되지 않습니다.
답변
커밋 전에 Git 추가를 취소 할 수 있습니다
git reset <file>
다른 것을 변경하지 않고 현재 색인 ( "tommited to committed"목록)에서이를 제거합니다.
당신이 사용할 수있는
git reset
모든 기존 변경 사항을 해제하기 위해 파일 이름이 없습니다.이것은 합리적인 시간에 하나씩 나열된 파일이 너무 많으면 편리 할 수 있습니다.
이전 버전의 Git에서 위의 명령은 Git Reset Head
"git reset" (without options or parameters) used to error out when you do not have any commits in your history, but it now gives you an empty index (to match non-existent commit you are not even on).
문서 : GIT 재설정
출처:
https://stackoverflow.com/questions/348170/how-do-i-undo-git-add-before-commit
최근댓글