CS/형상관리

[git] git cmd 명령어

얌얌념념 2022. 9. 29. 09:08

https://studyingazae.tistory.com/18

 

[Git] Git 기본 명령어 / 기본사용법 (CMD 및 Bash 사용법)

* git-CMD, git-Bash 명령어, add, pull, push, commit, Branch, Github Desktop와 관련된 내용. * CLI 명령어를 사용할거면 Git-Bash 또는 Git-CMD 중 편할 걸 사용한다. * Git 설치가 안되있으면 아래 포스팅부터 시작 2021.0

studyingazae.tistory.com

 

1. Git 폴더 초기화 (init / pull)

git init : 현재 폴더를 기준 폴더로 하고 git을 관리
git pull : 현재 폴더에 모든 github 파일 업데이트

 

2. Git 상태 확인 (status / log)

git status : 현재 상태 출력
git log : 현재 commit 로그 등 출력

3. Branch 확인/생성/이동

// 저장소 확인 git remote

// 브랜치
git branch : 모든 브랜치 확인, 현재 브랜치 색 다름
git branch 브랜치명 : 새로운 브랜치 생성
git checkout 브랜치명 : 브랜치 이동
git merge 합쳐질_브랜치명 : 명령어를 실행하는 브랜치에 합쳐질_브랜치가 합쳐짐

 

4. Github에 업로드 (add / commit / push)

// 업로드할 파일 추가
git add 파일명
git add *

// commit
git commit -m "코멘트"

// 최신 commit 코멘트 수정
git commit --amend

// commit revert (히스토리 유지)
git revert 원복할 commitID

// 업로드
git push 저장소명 브랜치명
git push origin main

 

5. git flow

git-flow --help