NLP/AI/Statistics

Git 코드 요약 정리 본문

Git

Git 코드 요약 정리

Danbi Cho 2020. 9. 29. 11:21

 

 

[git 생성 및 가져오기]

- git init: git 생성하기

- git clone git_path: 코드 가져오기

 

[공동 작업 시 브랜치 사용]

- git checkout branch_name: 브랜치 선택하기

- git checkout -t remote_path/branch_name: 원격 브랜치 선택하기

- 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 add file_path: 수정한 코드 선택하기 (git add *)

- git commit -m "commit_description": 선택한 코드 설명 적기 (git commit -m "내용")

- git push remote_name branch_name: add하고 commit한 코드 git server에 보내기 (git push origin master, 혹은 git push)

- 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계정 email 변경하기

- git stash / git stash save "description": 작업코드 임시저장하고 브랜치 바꾸기

- git stash pop: 마지막으로 임시저장한 작업코드 가져오기

- git branch --set-upstream-to==remote_path/branch_name: git pull no tracking info 에러해결

 

 

[출처] medium.com/@pks2974/%EC%9E%90%EC%A3%BC-%EC%82%AC%EC%9A%A9%ED%95%98%EB%8A%94-%EA%B8%B0%EC%B4%88-git-%EB%AA%85%EB%A0%B9%EC%96%B4-%EC%A0%95%EB%A6%AC%ED%95%98%EA%B8%B0-533b3689db81

 

자주 사용하는 기초 Git 명령어 정리하기

제가 서비스를 개발하면서 자주 사용하던 git 명령어를 정리해보려고 합니다.

medium.com

[이미지출처]www.c-sharpcorner.com/article/git-and-github-version-control-local-and-remote-repository/

 

Git And Github Version Control (Local And Remote Repository)

In this article, you will learn about Git and version control in GitHub (Local And Remote Repository).

www.c-sharpcorner.com

'Git' 카테고리의 다른 글

Git 원격 저장소 연결 및 끊기 (git remote)  (0) 2021.01.20
Git add, commit 취소  (0) 2020.10.13
Git commit message 변경 및 이전 작업 상태로 돌아가기  (0) 2020.10.03
Git 개념  (0) 2020.09.29
Comments