GitHub 재시작(기본 작업)
기본 작업
1. 파일 등록
2. 파일 업데이트
3. 제출
4. 파일 해제

5. 차이 확인

1. 파일 등록
1-1. 파일 등록(untracked->staged)
cmd
echo "# create" > file_1.md
git add file_1.md

1-2. 논리적 취소
cmd
git reset HEAD file_1.md

2. 파일 업데이트
2-1. 파일 업데이트(unmodified->modified->staged)
cmd
echo "# update" >> file_1.md
git add file_1.md

2-2. 논리적 취소
cmd
git reset HEAD file_1.md

2-3. 물리적으로 staged로 취소
cmd
git checkout file_1.md

2-4. 최신 제출 때까지 물리적 취소
cmd
git checkout HEAD file_1.md

3. 제출
3-1. 정상 제출
cmd
git commit -m "coment"

3-2. 제출 건너뛰기 (add+commit)
cmd
git commit -a -m "coment"

(*) untracked 파일을 생략하여 제출할 수 없습니다.
3-3. 이 커밋을 최신 커밋에 통합하여 커밋
cmd
git commit --amend -m "coment"

3-4. 논리적 취소 (최신 제출 전 복원)
cmd
git reset --soft HEAD^

3-5. 물리적 취소 (마지막 제출 후 복구)
cmd
git reset --hard HEAD^

4. 파일 해제
4-1. 논리 해제 (파일 삭제 안 함)
cmd
git rm --cached file_*

4-2. 물리적 삭제(파일이 삭제됨)
cmd
git rm -f file_3.md
git rm file_*

4-3. 물리적 이동
cmd
git mv file_1.md file_4.md

5. 차이 확인

5-1. modified와staged 비교
cmd
git diff file_1.md
5-2. 커밋된 및 최신 커밋 비교
cmd
git diff --staged file_1.md
5-3. modified+staged와 최신 제출 비교
cmd
git diff HEAD file_1.md

Reference
이 문제에 관하여(GitHub 재시작(기본 작업)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/qio9o9/items/b5a74dcc89d0aac7f83e텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)