git 사용법 관련

sykim·2020년 3월 22일
0
post-thumbnail

pull request 하는 법

https://wayhome25.github.io/git/2017/07/08/git-first-pull-request-story/
https://sanghaklee.tistory.com/30

커밋 메세지 규칙

https://mingnol2.tistory.com/129

브랜치 용어 정리

git branch branch_name : 'branch_name' 브랜치 생성하기
git checkout branch_name : 'branch_name' 브랜치 선택하기

git commit -am "커밋메세지" : git add 과정을 commit -m 과정과 합친다. 하지만 add가 이미 된 파일에 한해서만 해당 명령어가 사용 가능하다.

https://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

내 branch를 origin으로 올리기

git push origin class/#1_슬랙닉네임

원격 저장소의 branch 가져오기

만약 원격 저장소의 feature/create-meeting branch를 가져오고 싶다면,

$ git remote update
$ git checkout -t origin/feature/create-meeting

https://cjh5414.github.io/get-git-remote-branch/

git push 취소하기

  • 워킹 디렉토리에서 commit 되돌리기
// 가장 최근의 commit을 취소 (기본 옵션: --mixed)
$ git reset HEAD^
$ git reset --hard HEAD
  • 원하는 시점으로 워킹 디렉토리 되돌리기
// Reflog(브랜치와 HEAD가 지난 몇 달 동안에 가리켰었던 커밋) 목록 확인
$ git reflog 또는 $ git log -g
// 원하는 시점으로 워킹 디렉터리를 되돌린다.
$ git reset HEAD@{number} 또는 $ git reset [commit id]
  • 변경사항 add 후 다시 commit -m "~"
  • 원격저장소에 강제 push
$ git push origin [branch name] -f
또는
$ git push origin +[branch name]
https://gmlwjd9405.github.io/2018/05/25/git-add-cancle.html

https://gmlwjd9405.github.io/2018/05/25/git-add-cancle.html
https://jupiny.com/2019/03/19/revert-commits-in-remote-repository/

git 로컬 강제 덮어쓰기

git fetch --all git 
reset --hard origin/master
profile
블로그 이전했습니다

0개의 댓글