📌 흐름을 이해하기
$ git init
$ git status
On branch master
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)
No commit yet
아직 커밋되지 않았다
Untracked files
못보던 새로운 파일이 생겼습니다!
$ git add test.txt
// 아무것도 안뜨면 잘 add 된거임
$ git status
On branch master
No commits yet
Changes to be committed: // 변화가 감지됐다!
(use "git rm --cached <file>..." to unstage)
new file: test.txt
$ git rm --cached test.txt
rm 'test.txt'
$ git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
test.txt
$ git add . // 모두 staging area 로 옮겨라! 는 의미
$ git commit -m "commit message"
$ git commit -m "first commit"
[master (root-commit) 0c580a9] first commit
1 file changed, 1 insertion(+)
create mode 100644 test.txt
커밋 메세지가 뭔가요?
📌 어떤 변경사항이 생겨서 버전을 생성했는지 알려주기 위해 적는 메시지
$ git log
commit 0c580a93a7919d0c6ec3ab99a01153ac534d5537 (HEAD -> master)
Author: Eugene Kim <hash_ff0000@naver.com>
Date: Wed Apr 26 01:39:24 2023 +0900
first commit
$ 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: test.txt
no changes added to commit (use "git add" and/or "git commit -a")
$ git add test.txt
$ git status
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: test.txt
$ git commit -m "add string to test"
[master 7f63648] add string to test
1 file changed, 1 insertion(+), 1 deletion(-)
$ git log
commit 7f63648c15ef69c06a302883b098f9b384883d26 (HEAD -> master)
Author: Eugene Kim <hash_ff0000@naver.com>
Date: Wed Apr 26 01:49:38 2023 +0900
add string to test
commit 0c580a93a7919d0c6ec3ab99a01153ac534d5537
Author: Eugene Kim <hash_ff0000@naver.com>
Date: Wed Apr 26 01:39:24 2023 +0900
first commit
commit할때 -m을 붙이지 않으면 자동으로 vi가 실행되는데, 그곳에 commit message를 더욱 자세히 적을 수 있다!
어떻게 다른 사람과 원격으로 협업을 할 수가 있는거죠?
효율적으로 백업했다고 말할 수 있나요?
⇒ 그래서 깃헙을 쓰는거다!
: 각자의 컴퓨터에만 존재하는 버전을 저장, 관리해주는 서비스
github에 코드를 업로드 한다 == github에 push
한다.
📌 내 컴퓨터 : Local 저장소
github이 관리하는 컴퓨터 : 원격 저장소
Repository에 있는 모든 version이 모두 원격 저장소로 올라간다고 생각하면 됩니다
https://www.inflearn.com/course/%EB%B9%A0%EB%A5%B4%EA%B2%8C-git/dashboard