Notice
Recent Posts
Recent Comments
Link
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

기록

02_Commit 본문

공부/Git

02_Commit

aoieuo 2020. 9. 30. 16:57

Tutorial 1

새 저장소 만들기

kyY00n이라는 폴더에 새로운 저장소를 만들 것이다. (깃은 이미 설치 되어있어야한다.)

콘솔창을 해당 폴더 위치에서 열어준 후 다음 명령을 입력한다.

$ git init

파일 커밋(Commit)하기

kyY00n 폴더에 새로운 파일을 추가하고, 원격 저장소에 파일을 등록할 것이다.

kyY00n폴더 안에 'git-tutorial.txt'라는 파일을 생성했다고 가정하자.

작업트리와 인덱스 상태 확인(Status)

$ git status

아직은 'git-tutorial.txt'가 생성된 이력을 인덱스에 추가하지 않았으므로

$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#     git-tutorial.txt
nothing added to commit but untracked files present (use "git add" to track)

위와 같이 untracted files로 git-tutorial.txt가 보인다.

파일을 인덱스에 등록하기

$ git add git-tutorial.txt 

add 명령어를 사용하여 파일을 인덱스에 추가한다.

그 후 status를 다시 확인하면

$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#     new file:   git-tutorial.txt
#

커밋 준비 끝!

커밋 진행하기

$ git commit -m "first commit"

커밋 완료 후 status 다시 보기

$ git status
# On branch master
nothing to commit (working directory clean)

이제 모든 변경사항이 커밋되었다.

저장소의 변경 이력을 확인해보면 (log 명령어)

$ git log
commit ac56e474afbbe1eab9ebce5b3ab48ac4c73ad60e
Author: 윤가영 <rkdkdudjd@gmail.com>
Date:   Thu  Sep 8 14:03:03 2020 +0900

    first commit

'공부 > Git' 카테고리의 다른 글

05_Merge  (0) 2020.09.30
04_Remote  (0) 2020.09.30
03_Repository  (0) 2020.09.30
01_Git  (0) 2020.09.30
Comments