커밋을 수정하는 방법?
2583 단어 gittutorialbeginnersprogramming

마지막 명령에서 다음과 같이 작성했다고 상상해 봅시다.
git commit -m "adding fils"
수정하려면 다음을 입력하십시오.
git commit -m "adding files" --amend
git이 제공하는 두 가지 중요한 명령
git --hard
및 git soft
HARD = 일반적으로 우리가 코드를 엉망으로 만들고 모든 것을 엉망으로 만들기 전의 상태로 되돌리고 싶을 때 사용됩니다. 되돌리기와 같은 기능이니 주의하세요.
SOFT = 반면에 Soft는 커밋에서 변경 사항을 제거하지 않고 커밋 목록에서 커밋을 제거합니다.

그리고 우리의 경우 마지막 3개의 커밋을 삭제하려고 합니다.
git reset --soft HEAD~3
그리고
git log
를 넣어 확인할 수 있습니다.
또한 파일이 커밋될 것임을 확인합니다.

터미널별 인터페이스 경험 Git
또 다른 방법(문서에 따르면 가장 정확한 방법)은 다음 명령을 내리는 것입니다.
git rebase -i HEAD~3

그리고 우리는 명령 선택을 스쿼시로 변경할 수 있습니다.
녹음할 때 수행한 작업을 알리는 다른 화면이 나타납니다.

또한 적절한 메시지를 입력하도록 요청할 것입니다.

결과

내가 당신을 도왔기를 바랍니다.
Reference
이 문제에 관하여(커밋을 수정하는 방법?), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/ramirezmz/how-to-fix-a-commit-blh텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)