일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- workbench
- Git_정리
- Linux_명령어정리
- SQL_용어정리
- DML
- CSS
- asp.net
- MySQL
- json
- Linux
- 배열
- Spring_에러정리
- SQL
- HTML
- jsp
- java
- git
- 인스턴스
- 자바스크립트
- 이클립스
- github
- 자바
- 인덱스
- spring
- vb.net
- Git_명령어정리
- Spring_오류정리
- 다이어그램
- 아파치톰캣
- JavaScript
- Today
- Total
데브마우스
[Git] 작업 트리에서 파일 수정하는 방법 정리 본문
git init을 하여 이미 test-git 디렉터리가 git 저장소로 초기화되어 있다고 가정합니다.
아래 명령어를 입력하여 git의 상태를 확인합니다.
git status
출력:
On branch main
No commits yet
nothing to commit (create/copy files and use "git add" to track)
test-git 디렉터리에 메모장으로 test.txt를 추가하고 test를 작성였습니다.
git status
출력:
On branch main
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
test.txt
nothing added to commit but untracked files present (use "git add" to track)
git add test.txt
git status
출력:
On branch main
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: test.txt
git commit 명령어로 커밋합니다.
git commit -m "test1"
[main (root-commit) 60fa2f1] test1
1 file changed, 1 insertion(+)
create mode 100644 test.txt
git status
On branch main
nothing to commit, working tree clean
git log로 확인한 결과 파일이 커밋되신걸 확인할 수 있습니다.
user.name과 user.email은 사용자에 따라 다르게 출력될 수 있습니다.
git log
commit 60fa2f17fbce82a48457f8ff2f880e86a876acef (HEAD -> main)
Author: user.name <user.email>
Date: Wed Jan 10 17:33:04 2024 +0900
test1
아래 명령어를 통해서 파일 별로 스테이지에 올리는게 아닌 수정한 파일을 스테이지에 올리는 동시에 커밋까지 하는 코드입니다.
git commit -am "메시지 내용"
'Git > Git: 정리' 카테고리의 다른 글
[Git] 브랜치 개요 및 생성방법 정리 (0) | 2024.01.10 |
---|---|
[Git] tracked 그리고 untracked, unmodified, modified, stage 상태 정리 (0) | 2024.01.09 |
[Git] 작업 트리, 스테이지, 저장소 정리 (0) | 2024.01.09 |
[Git] 깃으로 디렉터리를 초기화하여 저장소로 만드는 방법 정리 (0) | 2024.01.09 |
[Git] 깃 설치 후 확인 방법 및 깃 환경 설정 방법 정리 (0) | 2024.01.09 |