개발새발

[git] 유용한 git 명령어들 본문

개발/Lang

[git] 유용한 git 명령어들

allkites 2021. 7. 21. 00:31

git 만들기

$ git init

$ touch .gitignore    # gitignore.io 사이트

$ touch README.md 

$ git status

$ git add .

$ git status

$ git commit -m "메세지"

#새로운 new projets 주소 만든 후 복붙
$ git remote add origin https://new_projects 주소.git

$ git push origin master

git 푸쉬

git bash에서..
$ git status #빨간색 파일색

$ git add .

$ git status #초록색 파일색

$ git commit -m "파일명 입력"

($ git status #nothing이 나와야함)

$ git push

git init 취소

$ rm -r .git

이전 git add 삭제

$ git reset HEAD <파일명>

이전 commit 수정

$ git commit --amend

> i 누르고 끼워넣기 상태로 수정
> esc 끼워넣기 모드 취소
> :wq 저장명령 주기

pull request

# branch 삭제 후 변경사항 pull 받기
$ git switch master

(master)
$ git pull origin master

(김해킹)
$ git add 김해킹.py  # 파일 단위로 add
$ git commit -m 'comment'
$ git switch -c <김해킹>
$ git push origin 김해킹


# pull request 이후 기존 branch 삭제
(김해킹)
$ git switch master

(master)
$ git pull origin master  
$ git branch -d 김해킹

git flow

# develop에서 feature branch 생성
$ git checkout -b feature/{이름}

# git add, git commit 후 develop branch로 체크아웃
$ git checkout develop

# branch 병합
$ git merge feature/{이름}

# branch 삭제
$ git branch -d feature/{이름}

'개발 > Lang' 카테고리의 다른 글

[Python] itertools 없이 순열, 조합 구현하기  (0) 2021.09.04
Comments