본문 바로가기

Python_Beginer

(145)
[GIT]Git reset HEAD^(최신 커밋 취소 + 스테이지 취소) Git은 버전 관리 시스템으로, 프로젝트의 이전 버전을 검색하고 복원할 수 있습니다. 이를 위해 Git은 여러 명령어를 제공합니다. 이 중에서 reset 명령어는 커밋을 취소하고, 스테이지를 취소하는 등 프로젝트를 이전 상태로 되돌리는 기능을 합니다. Git reset 명령어에는 HEAD^, HEAD~n 등 다양한 옵션이 있습니다. 최신 커밋 취소 + 스테이지 취소를 위해서는 git reset HEAD^ 명령어를 사용합니다. 최근 취소 수량 커밋 취소를 위해서는 git reset HEAD~n 명령어를 사용합니다. 또한, reset 명령어에는 --soft, --mixed, --hard와 같은 옵션을 사용할 수 있습니다. --soft 옵션은 최근 커밋을 하기 전 상태로 작업트리를 되돌리는 옵션입니다. --m..
[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..