본문 바로가기
Infra/Git

버전 생성

by 골든크랩 2022. 8. 22.
728x90
반응형

1. git init 을 하면, 하단에 master 표시가 나옴

2. git status

현재 깃의 상태를 나타낸다.

 

PS C:\Projects\GIT-TEST> git status
On branch master   <============== master 란 브랜치에서 작업중이다.

No commits yet       <============== commit 된게 없다.  작업 내역(버전)

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        index.html        <============== 추적되고 있지 않은 파일은 index.html 파일이다.(추적 장치가 안달려 있다라는 의미)

nothing added to commit but untracked files present (use "git add" to track)

 

3. git add

추적 장치를 달아주자.

PS C:\Projects\GIT-TEST> git add . <=== 작업 디렉토리상의 변경 내용을 스테이징 영역(staging area)에 추가

                      <=== 동일 결과 명령어로... git add index.html..그런데 파일이 많아지면 일일이 치기 어려워짐
PS C:\Projects\GIT-TEST> 

 

위와 같이 master에 + 부호가 붙고, git status 로 보면..new file: index.html 이 추가된 걸 볼 수 있다.

 

4. git commit

버전을 생성하겠다의 의미

5. git log

commit 로그를 볼수 있음.

 

PS C:\Projects\GIT-TEST> git log
commit 518b4ee4953973c48e69e44322568a6baff15347 (HEAD -> master)  ====> commit 의 id 값에 해당
Author: wizarddennis <travlInfo4you@gmail.com>
Date:   Mon Aug 22 12:11:55 2022 +0900                                                         =====> commit 날자

    프로젝트 생성
PS C:\Projects\GIT-TEST> 

 

6. 파일 편집후 살펴보기

VSCode 오른쪽에 M 자 생김.  Modified 의 약어.

PS C:\Projects\GIT-TEST> git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   index.html

no changes added to commit (use "git add" and/or "git commit -a")
PS C:\Projects\GIT-TEST>

 

7. 스테이징 영역에 추가하기

PS C:\Projects\GIT-TEST> git add .  ===> 작업 디렉토리상의 변경 내용을 스테이징 영역(staging area)에 추가하기 
PS C:\Projects\GIT-TEST> git status
On branch master
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   index.html

PS C:\Projects\GIT-TEST>

 

8. commit (다른 버전) 만들기..

PS C:\Projects\GIT-TEST> git commit -m '타이틀 태그 수정'
[master 0ad9d90] 타이틀 태그 수정
 1 file changed, 12 insertions(+)
PS C:\Projects\GIT-TEST>
PS C:\Projects\GIT-TEST> git status
On branch master
nothing to commit, working tree clean
PS C:\Projects\GIT-TEST> 

 

9. git log 로 변화 내역 확인

PS C:\Projects\GIT-TEST> git log
commit 0ad9d908cf46146b303b5df828f8e894f9b3381d (HEAD -> master)  ==>  전체 목록에서 현재 버전으로 HEAD->master 로 표시됨...HEAD는 현재 버전을 나타내는 키워드이다. 현재 버전은 master 라는 브랜치로 만들어져 있다.
Author: wizarddennis <travlInfo4you@gmail.com>
Date:   Mon Aug 22 14:23:02 2022 +0900

    타이틀 태그 수정

commit 518b4ee4953973c48e69e44322568a6baff15347
Author: wizarddennis <travlInfo4you@gmail.com>
Date:   Mon Aug 22 12:11:55 2022 +0900

    프로젝트 생성
PS C:\Projects\GIT-TEST> 

 

 

 

 

 

 

 

728x90
반응형

댓글