With Computer/Git, GitHub

[생활코딩] git2 - cli버전관리 -4.버전만들기

s:tardust 2020. 2. 9. 15:00

working tree

작업하는 공간

staging area

버전 합치는 곳

repository

버전 올리는곳(관리하는 곳)


nano hello1.txt
hello1.txt 파일 생성
ctrl + x  나가기 y 저장 enter로 밖으로 나옴
ls -al 조회하면 파일 확인 할 수 있고
cat hello1.txt 해당 파일 내용 확인
git status  앞으로 git쓰면서 제일 많이쓸 문장
no commits yet ===> 커밋==버전 
아직 버전이 없어용
Untracked files -> 아직 관리되고 있지 않음
 git add hello1.txt 하고
 git status를 해보면
Changes to be committed: 버전관리 시작
즉, working tree에 있던 hello1.txt가 
staging area로 옮겨짐
그리고 
git commit -m "Message 1"
[master (root-commit) 77fb0d7] Message 1
 1 file changed, 1 insertion(+)
 create mode 100644 hello1.txt
이 상태에서
git status를 해보면, 
버전 관리할게 없다고 나오고
git log(역사를 보고싶다) 하면
이후 나가고 싶으면 q 눌러주세용nano hello1.txt
hello1.txt 파일 생성
ctrl + x  나가기 y 저장 enter로 밖으로 나옴
ls -al 조회하면 파일 확인 할 수 있고
cat hello1.txt 해당 파일 내용 확인
git status  앞으로 git쓰면서 제일 많이쓸 문장
no commits yet ===> 커밋==버전 
아직 버전이 없어용
Untracked files -> 아직 관리되고 있지 않음
 git add hello1.txt 하고
 git status를 해보면
Changes to be committed: 버전관리 시작
즉, working tree에 있던 hello1.txt가 
staging area로 옮겨짐
그리고 
git commit -m "Message 1"
[master (root-commit) 77fb0d7] Message 1
 1 file changed, 1 insertion(+)
 create mode 100644 hello1.txt
이 상태에서
git status를 해보면, 
버전 관리할게 없다고 나오고
git log(역사를 보고싶다) 하면
이후 나가고 싶으면 q 눌러주세용
nano hello1.txt 로 수정할 파일 open
ctrl+x - y - Enter 후
cat hello1.txt로 수정사항 확인
git status눌러서 commit되지 않은 걸 확인 후
Changes not staged for commit:
(스테이지가 아니라 워킹트리에 있음)
git add hello1.txt 입력해 스테이지로 옮겨줌
(== git add .해도됨, 파일이 그거 하나니께)
git status로 확인
modified된 hello1.txt 확인 가능
이 상태에서 버전을 만드려면
git commit -m "Message 2"



즉, working tree에는 수정한 내용이 있다.
staging area에는 수정한 내용중 버전으로 관리할 파일이 있다.
그리고 repository에는 수정해온 내용들의 변경사항의 최종본을 저장한다?

반응형