https://git-scm.com/download/win
inky4832@daum.net (owner)
inky4833@gmail.com ( collaborator)
git config --global user.name "inky4832"
git config --global user.email "inky4832@daum.net"
위 정보는 C:\Users\ssginc76\의 .gitconfig 에 저장됨
c:\git_study
git init <=== 로컬저장소로 만듬. .git 폴더가 생김.이곳에 버전들이 저장됨.
git status
On branch main
No commits yet
nothing to commit (create/copy files and use "git add" to track)
위 결과는 다음과 같다
hello1 입력
git status
On branch main
No commits ye
Untracked files:
(use "git add < file>..." to include in what will be committed)
hello.txt
hello.txt.bak
nothing added to commit but untracked files present (use "git add" to track)
위 결과는 다음과 같다.
git add 파일명
git add 파일명 파일명2 ....
git add sub/파일명
git add .
git status
Changes to be committed:
(use "git rm --cached < file>..." to unstage)
new file: hello.txt
위 결과는 다음과 같다.
git commit -m "커밋메시지"
git commit -m "first commit"
git status
On branch main
nothing to commit,~
위 결과는 다음과 같다.
git log
git reflog
hello3 추가
add + commit 한번에
git commit -am "third commit"
https://www.toptal.com/developers/gitignore
.gitignore 파일 작성
*.bak
.gitignore
작업 트리---git add---스테이지---git commit---저장소
git init한
git_study 폴더
git diff 비교 : 작업 트리와 저장소 비교
git diff --staged 비교 : 작업 트리와 스테이지 비교
git_rollback 폴더작성
git init
hello.txt 파일 생성
hello1 저장
git add hello.txt
git commit -m "first commit"
hello2 저장 <== 이 작업을 취소할 예정임.
되돌리기
git restore hello.txt
이후 hello.txt 파일에 hello1 만 남음.
현재상태확인
hello2 저장
git status
On branch main
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: hello.txt
git add hello.txt
git status
On branch main
Changes to be committed:
(use "git restore --staged < file>..." to unstage)
modified: hello.txt
스테이지 되돌리기
git restore --staged hello.txt
git status
On branch main
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: hello.txt
hello2 추가
git commit -am "second commit"
hello3 추가
git commit -am "third commit"
git reset --hard 해시값
git branch
git branch <브랜치명>
예> git branch hotfix
git checkout <브랜치명>
예> git checkout hotfix
반드시 main에서 병합처리 한다.
git merge <브랜치명>
예> git merge hotfix