git add 혹은 commit 취소

Urther·2021년 10월 3일
0

GitHub

목록 보기
5/6
post-thumbnail

commit은 자주하되, push는 늘 신중하게 !!
그래도 잘못올린 순간 어떻게 해야할까요!


🧰 변경사항이 너무 많을 때

파일에 modified 된 것이 많다.
수정하기 전 상황으로 전체 돌아가고 싶다면 어떻게 해야할까?

처음으로 돌아가고 싶은 파일이 README.md일 경우
git checkout--README.md

modified 되었다는 것이 없어졌다는 사실은 git status를 통해 알 수 있다.

➕ git add 취소

이미 add 한 파일이 README.md 파일이라면,
git reset HEAD README.md

🐻 git commit 취소

git log를 통해 commit 메시지를 확인 할 수 있다.

git commit message를 수정하고 싶다면?
git commit --amend

이미 commit한 파일들을 취소하고 싶다면?
git revert --no-commit HEAD..

profile
이전해요 ☘️ https://mei-zy.tistory.com

0개의 댓글