Ankiwoong (1841) 썸네일형 리스트형 [GIT]Git Reset HEAD(스테이징을 취소) $ vim hello2.txt $ git add hello2.txt $ git status $ git reset HEAD hello2.txt $ git status 1. git reset head 파일명 : 해당 파일을 스테이징 취소 2. git reset head : 스테이지에 있는 모든 파일을 취소 3. Unstaged : 취소상태 4. Not Staged : 스테이지에 올라가기전 상태 [GIT]Git Checkout(작업트리 수정 파일 취소) $ vim hello.txt $ git status $ git checkout -- hello.txt $ git status $ vim hello.txt 1. git checkout -- 파일명 : 수정한 내용을 취소하고 가장 최신 버전 상태로 되돌리기 [GIT]Unmodified, Modified, Staged(비수정상태 / 수정상태 / 커밋 직전 상태) $ ls -la $ git status $ vim hello2.txt $ git stauts $ git add hello2.txt $ git status $ git commit -m "delete b,c,d" $ git status $ git commit --amend $ git status 1. Unmodified : 수정되지 않은 상태 nothing to commit, working tree clean 2. Modified : 수정된 상태 modified: hello2.txt 3. Staged : 커밋 직전 단계 Changes to be committed: 4. git commit --amend : 커밋 메시지 수정 [GIT]Tracked File / Untracked File(추적상태 / 비추적상태) $ vim hello.txt $ vim hello2.txt $ git status $ git add hello.txt $ git add hello2.txt $ git commit -m "message3" $ git log $ git log --stat 1. Tracked : 한 번이라도 커밋을 한 파일의 수정 여부를 계속 추적하는 상태 Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git restore ..." to discard changes in working directory) modified: hello.txt 2. Untracked : 한 번도 깃에서 버전 관리를 하지 않았기 때문에.. [GIT]Git Diff(변경 사항 확인) 1. Git Diff : 작업트리에 있는 파일과 스테이지에 있는 파일을 비교 스테이지에 있는 파일과 저장소에 있는 최신 커밋을 비교해서 수정한 파일을 커밋하기 전에 검토 2. $ vim hello.txt $ git status $ git diff warning: LF will be replaced by CRLF in hello.txt. The file will have its original line endings in your working directory diff --git a/hello.txt b/hello.txt index 1191247..0b66db0 100644 --- a/hello.txt +++ b/hello.txt @@ -1,2 +1,2 @@ 1 -2 +two 3. 최신버전과 비교하여 달.. [GIT]Git Log(커밋 기록 확인) 1. Git Log : 커밋했던 기록 확인 $ git log commit 040d13b110d44c9d48fac14b0948225248f7a348 (HEAD -> master) Author: AnKiWoong Date: Thu Jan 2 20:43:17 2020 +0900 message2 commit 0f4285bedfbf470de8f325c6763e3a76713c4aa7 Author: AnKiWoong Date: Thu Jan 2 20:35:37 2020 +0900 message1 2. Git Hash / Commit Hash : 커밋을 구별하는 아이디 commit 040d13b110d44c9d48fac14b0948225248f7a348 3. 버전 확인 : (HEAD -> master) 라고 적혀있으면.. [GIT]Staging + Commit(스테이징 + 커밋) 1. 문서 수정 $ vim hello.txt 1 2 2. 깃 상태 확인 $ git status On branch master Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git restore ..." to discard changes in working directory) modified: hello.txt no changes added to commit (use "git add" and/or "git commit -a") 3. 스테이징과 커밋 처리 : 한번 커밋한 파일이라면 가능 $ git commit -am "message2" warning: LF will be replaced by C.. [GIT]Repository(저장소) 1. 저장소(Repository) : 스테이지에서 대기하고 있던 파일들을 버전으로 만들어 저장하는 곳 2. 커밋(Commit) : 버전을 만드는 것 3. git commit -m "메시지" $ git commit -m "message1" [master (root-commit) 0f4285b] message1 1 file changed, 1 insertion(+) create mode 100644 hello.txt 4. 깃 상태 확인 $ git status On branch master nothing to commit, working tree clean 5. 저장된 버전 확인 $ git log commit 0f4285bedfbf470de8f325c6763e3a76713c4aa7 (HEAD -> master.. 이전 1 ··· 136 137 138 139 140 141 142 ··· 231 다음