Git 사용 정리
01.현재 상태 확인
git status
--red color file : before adding to commit
--green color file : done adding to commit
02.수정사항 등록하기
# 파일하나
git add fileName
# 모든 파일
git add .
03.branch 확인
git branch
04.branch로 이동
git checkout branchName
# branch 생성 후 이동
git checkout -b branchName
05.commit
git commit -m "comment"
# delete Branch - 헤드에 병합되어 있을 경우
git -d branchName
# delete Branch - 강제 삭제
git -D branchName
# 브랜치 병합
git merger branchName
# git log 보기
git log
# 해당 헤드로 변경
git reset --hard commitKey
# 파일 만들기
touch fileName
# git 시작하기
# (글로벌) 사용자 등록
git config --global user.name "your github name"
git config --global user.email "yourgithub@resistered.email"
# (글로벌) 사용자 확인
git config --global --list
# 최초 저장소 등록시
git init
echo "# project_name" >> README.md
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/YourName/projectName.git
git push -u origin master
#email Id / pwd 입력
# git untracking file clean
git clean -f
# git untracking folder clean
git clean -fd
http://blog.outsider.ne.kr/
# git branch commit
git push oringin branchName
# origin : 현재의 branch
# 저장소 브랜치 확인
git remote show origin
# not staged file 로 인해 push가 되지 않을 시
#Changes not staged for commit:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
git checkout -- .
#참조
누구나 쉽게 이해할 수 있는 Git 입문 - 명령어 찾아보기