Git 설치 후 Git bash 실행 하면 Git command를 수행 할 수 있다.
git 저장소 생성(git init)
- 특정 폴더 생성 후 git init 수행ㅎ면 master git이 생성된다.
command: git init
git 저장소 제거(git rm -rf)
- git을 생성한 프로젝트로 이동 후 .git 제거 하면 프로젝트가 제거된다.
command: git rm -rf .git
현재 경로의 git 상태 확인(git status)
- changes to be committed: git add 한 파일의 내용을 보여 줌
- changes no staged for commit: 파일의 내용이 수정 되어 commit할 파일의 내용을 보여줌
- untracked files: add 할 파일의 내용을 보여줌
command: git status

파일을 tracked (git add)
- 파일을 index에 등록하여 tracked 하게 추가 한다.
command: git add a.txt b.txt
command: git add *.txt // 해당 경로의 모든 .txt 파일을 add 한다.
command: git add *. //모든 파일을 add 한다.
.gitignore file(add시 제외할 파일)
- .gitignore 파일을 현재 git 프로젝트에 생성 후 "*.txt" 추가 후 저장 후 git add *, git .txt 명령어를 입력하면 모든 파일이나 모든 .txt 파일을 add할 때 제외 할 수 있다.
branch에 수정 사항 추가commit(git commit)
- 수정된 파일이나 tracked(add한) 파일을 commit하여 저장소에 추가
command: git commit a.txt -m "a.txt 수정"
command: git commit *.txt -m "모든 txt 수정"
수정 사항 비교 (git diff)
- 저장소에 저장 되어있는 파일 내용과 비교 현재 파일의 다른 부분을 보여 줌.
command: git diff a.txt
commit 이력보기 (git log)
- 현재 선택된 branch의 commit 이력 보기
command: git log

branch 종류 검색 (git branch)
- 저장소에 저장 되어있는 파일 내용과 비교 현재 파일의 다른 부분을 보여 줌.
command: git branch
command: git branch -a // remote 저장소 내용까지 볼수 있음

branch 전환 (git checkout)
- git branch로 branch 검색한 branch명으로 branch로 전환 한다.
- *가 붙은 branch가 현재 선택되어있는 branch 이다
command: git checkout develop

branch 생성 (git branch "이름")
- 생성할 branch 이름을 name에 추가하여 생성
git branch "name"
branch 삭제 (git branch "이름")
- 삭제할 branch 이름을 branch name에 추가하여 삭제
git branch -d "branch name"
리모트 저장소 복사(git clone url)
- 현재 경로의 리모트 저장소의 master branch의 source를 복사
git clone url
리모트 저장소의 branch 생성 및 전환
- 리모트 저장소의 origin/develop와 같은 이름인 develop으로 branch 생성과 동시에 전환된다.
git checkout --track origin/develop
