$ mkdir gitstudy04 -------- 새 폴더 만들기
$ cd gitstudy04 -------- 만든 폴더로 이동
$ git init -------- 저장소를 깃으로 초기화
Initialized empty Git repository in E:/gitstudy04/.git/
infoh@hojin MINGW64 /e/gitstudy04 (master)
$ code index.htm -------- VS Code를 사용하여 파일 작성
infoh@hojin MINGW64 /e/gitstudy04 (master)
$ git status -------- 상태 확인
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
index.htm -------- 새로운 파일이 등록된 것을 확인
nothing added to commit but untracked files present (use "git add" to track)
git은 add 명령어를 기준으로 이전과 이후 단계를 구분
git add . : 전체 파일을 스테이지 영역에 등록하기
단, 빈 폴더는 등록되지 않는다.
메시지
$ git add index.htm -------- 스테이지에 등록
infoh@hojin MINGW64 /e/gitstudy04 (master)
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: index.htm
Untracked files:
(use "git add <file>..." to include in what will be committed)
index.htm -------- 스테이지 삭제
infoh@hojin MINGW64 /e/gitstudy04 (master)
$ git mv index.htm home.htm -------- 파일 이름 변경
$ git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: home.htm -------- 변경된 파일 이름
git commit -a: git add . + git commit
vi 에디터를 이용한 메시지
기본적인 커밋 메시지
git commit -m "커밋메시지" : 간단한 커밋메시지로 커밋하기
git commit --allow-empty-message-m ""
$ git log
commit 976a6b7bb40c2af75d4d84ce290295ff353a19a5 (HEAD -> master)
Author: nahyunbak <nahyunbak@naver.com>
Date: Thu Aug 26 21:21:57 2021 +0900
Add initial frontend code
landing pages
nahyu@nahyeon MINGW64 ~/Downloads/webd-master/실습/writingapp/frontend (master)
infoh@hojin MINGW64 /e/gitstudy04 (master)
$ git log --pretty=short -------- 로그 확인
commit aa92947d350db27b604d1351930d4f809f96886e (HEAD -> master)
Author: hojin <infohojin@gmail.com>
commit aa1dd51a8883b2ea9a54209a00f434a2da01ee85
Author: hojin <infohojin@gmail.com>
hello git world 추가
commit e2bce41380691b0a34aeab7db889a6c30fed8287
Author: hojin <infohojin@gmail.com>
인덱스 페이지 레이아웃
$ git show 976a6b7bb40c2af75d4d84ce290295ff353a19a5
commit 976a6b7bb40c2af75d4d84ce290295ff353a19a5
Author: nahyunbak <nahyunbak@naver.com>
Date: Thu Aug 26 21:21:57 2021 +0900
Add initial frontend code
landing pages
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..4d29575
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,23 @@
:
infoh@hojin MINGW64 /e/gitstudy04 (master)
$ git diff -------- 스테이지 vs 워킹 디렉터리 비교
diff --git a/index.htm b/index.htm
index f5097d9..56af0de 100644
--- a/index.htm
+++ b/index.htm
@@ -7,5 +7,6 @@
</head>
<body>
<h1>hello GIT world!</h1>
+ <h2>깃을 이용하면 소스의 버전 관리를 쉽게 할 수 있습니다.</h2> -------- 추가
</body>
</html>
\ No newline at end of file
infoh@hojin MINGW64 /e/gitstudy04 (master)
$ git diff head --------
diff --git a/index.htm b/index.htm
index f5097d9..56af0de 100644
--- a/index.htm
+++ b/index.htm
@@ -7,5 +7,6 @@
</head>
<body>
<h1>hello GIT world!</h1>
+ <h2>깃을 이용하면 소스의 버전 관리를 쉽게 할 수 있습니다.</h2>
</body>
</html>
\ No newline at end of file
( 그래프, 커밋메시지, 작성자, 날짜, 커밋아이디 )
디렉토리 안에 .git 폴더가 있으면 지우자.
프론트엔드와 백엔드는 별도로 관리하는 게 맞다.
git log의 시간 기록은 믿을 수 없다. 작업 중인 컴퓨터가 다른 지역의 시간 등으로 잘못 설정되어 있을 수 있기 때문이다.