🌟Git bash에서 환경설정하기
git config --global user.name "your_name"
git config --global user.email "your_email"
git config --list
🌟Github에 처음 코드 업로드하기
git init
git add .
#.은 모든 파일이라는 뜻, 파일을 선택해서 올리고 싶으면 add 뒤에 파일이름 ex)git add index.html
git status
git commit -m "first commit" #first commit 대신에 넣고싶은 메세지 입력
git remote add origin https://github.com/bitnaGithub/firstproject.git
git remote -v # 내가 연결한 주소값이 잘 뜨면 성공
git push origin master # branch에 올리고 싶으면 master 자리에 branch 이름이 들어가면 됨
🌟Github에 계속 업데이트 하는 법
git add .
git commit -m "first commit"
git push origin master
🌟Github로 팀프로젝트 하는 법
git clone 주소 폴더이름
git checkout -b 브렌치이름
git add .
git commit -m "first commit"
git push origin 브렌치이름
git pull origin master
git checkout 브렌치이름
🌟Issue 쓰는 법
1. Github에서 Issue를 생성한다.
2. 생성후 #번호를 확인한다
3. 히스토리를 만들 때 commit m ""안에 #번호를 입력해준다
git init : git 초기화
git remote add origin 원격저장소주소 : 원격 저장소에 연결
git remote -v : 원격 저장소에 잘 연결되었는지 확인
git push -u origin master : 지역 저장소의 브랜치를 원격 저장소의 마스터 브랜치와 연결 (한번만 하면됨)
git push : 원격 저장소에 올리기
git clone 원격저장소주소 지역저장소디렉토리 : 원격저장소 가져오기
git pull origin master : 원격 저장소의 내용을 지역 저장소의 마스터브랜치로 가져오기
git fetch : 원격 저장소의 브랜치 변화 정보만 가져오기
git status : 깃 상태 확인
git diff : 깃 변경 내용 확인
git config --global user.name "유저 이름" : 깃 사용자 이름 설정
git config --global user.email "이메일 주소" : 깃 사용자 이메일 설정
git config --global core.editor "vim" : 커밋 편집에디터를 vim으로 변경하기
git add 특정파일명 : 특정파일을 스테이징 하기
git add . : 전체 파일 스테이징 하기
git commit -m "메세지 내용" : 메세지와 함께 커밋하기
git commit -am "메세지 내용" : 스테이징과 커밋을 메세지와 함께 올리기
git commit --amend : 방금 커밋한 메세지 수정하기
git clone git_path : 코드가져오기
git checkout branch_name : 브랜치 선택하기 ('브랜치 이름'으로 브랜치 이동)
git checkout -t remote_path/branch_name : 원격 브랜치 선택하기
git checkout --파일이름 : 작업트리에서 수정한 파일 되돌리기
git branch branch_name : 브랜치 생성하기
git branch -r : 원격 브랜치 목록보기
git branch -a : 로컬 브랜치 목록보기
git branch -m branch_name change_branch_name : 브랜치 이름 바꾸기
git branch -d branch_name : 브랜치 삭제하기
git push remote_name — delete branch_name : 원격 브랜치 삭제하기 ( git push origin — delete gh-pages )
git log : 커밋 기록 보기
git log --stat : 커밋 기록을 커밋에 관련괸 파일과 함께 보기
git log --oneline : 로그를 한줄로 표기
git log --oneline --branches : 각 브랜치의 커밋을 확인
git log --oneline --branches --graph : 그래프 형식으로 표현
git log 브랜치1 ..브랜치2 : 브랜치1과 브랜치2사이의 차이점 보기
git merge 병합할브랜치이름 : 브랜치 병합
git stash / git stash save “description” : 지금하던 작업을 임시로 저장 (작업코드 임시저장하고 브랜치 바꾸기)
git stash pop : 마지막으로 임시저장한 작업코드 가져오기
git stash list : stash 목록 확인하기
git stash apply : git stash로 저장했던 작업 가져오기
git stash drop : stash 제거하기
git stash clear : 임시로 저장했던 stash 모두 제거
git stash show -p | git apply -R : 실수로 잘못 stash 한거 되돌리기
git add file_path : 수정한 코드 선택하기 ( git add )
git commit -m “commit_description” : 선택한 코드 설명 적기 ( git commit -m “내용”)
git push romote_name branch_name : add하고 commit한 코드 git server에 보내기 (git push origin master)
git pull : git서버에서 최신 코드 받아와 merge 하기
git fetch : git서버에서 최신 코드 받아오기
git reset — hard HEAD^ : commit한 이전 코드 취소하기
git reset — soft HEAD^ : 코드는 살리고 commit만 취소하기
git reset — merge : merge 취소하기
git reset — hard HEAD && git pull : git 코드 강제로 모두 받아오기
git config — global user.name “user_name ” : git 계정Name 변경하기
git config — global user.email “user_email” : git 계정Mail변경하기
git branch — set-upstream-to=remote_path/branch_name : git pull no tracking info 에러해결
git reset HEAD 파일이름 : 스테이징 취소
git reset HEAD^ : 최신 커밋 취소
git reset 커밋해시 : 특정 커밋으로 되돌리기
git rm --cached -r venv
감사합니다 이 글을보고 깃 장인이 되었습니다!