본문 바로가기

전체 글

(1837)
[GIT]Branch Generation(브랜치 생성) 1. 기본 설정 $ mkdir manual $ cd manual $ git init $ ls -al $ vim work.txt $ git add work.txt $ git commit -m "work 1" $ git log $ vim work.txt $ git commit -am "work 2" $ vim work.txt $ git commit -am "work 3" $ git log 2. Branch : 커밋을 가르키는 포인터 / master 브랜치에서 뻗어 나오는 새 브랜치를 만드는 것 3. git branch : 브랜치를 확인 $ git branch 4. git branch 브랜치명 : 브랜치명을 생성 $ git branch $ git branch apple $ git branch $ git bra..
[GIT]Git Revert(커밋 삭제하지 않고 취소) $ vim rev.txt $ vim commit -am "R5" $ git log $ git revert 379d5e3ee5acc90208764e0bde93f13eb1e20a19 $ git log $ cat rev.txt 1. git revert 취소할 commit Hash : 커밋을 삭제하지 않고 취소
[GIT]Git Reset(특정 커밋으로 취소) $ vim rev.txt $ git add rev.txt $ git commit -m "R1" $ vim rev.txt $ git commit -a -m "R2" $ git log $ git reset --hard dfd4d8ea6273aa2237c57f383981791cd56a3b80 $ git log $ cat rev.txt 1. git reset : 특정 커밋으로 되돌리기 2. commit Hash = commit ID 3. commit Hash commit dfd4d8ea6273aa2237c57f383981791cd56a3b80
[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 : 한 번도 깃에서 버전 관리를 하지 않았기 때문에..