git 명령어
              
          2020. 4. 3. 11:29ㆍ카테고리 없음
# commit 로그
$ git log
# commit 로그 수정
$ git commit --amend
# commit 취소
// [방법 1] commit을 취소하고 해당 파일들은 staged 상태로 워킹 디렉터리에 보존
$ git reset --soft HEAD^
// [방법 2] commit을 취소하고 해당 파일들은 unstaged 상태로 워킹 디렉터리에 보존
$ git reset --mixed HEAD^ // 기본 옵션
$ git reset HEAD^ // 위와 동일
$ git reset HEAD~2 // 마지막 2개의 commit을 취소
// [방법 3] commit을 취소하고 해당 파일들은 unstaged 상태로 워킹 디렉터리에서 삭제
$ git reset --hard HEAD^
# reset 취소

# remote push 취소
// 로컬 HEAD 설정
$ git reset --hard HEAD~{n}
ex) $ git reset --hard HEAD~1 //커밋 하나 취소
// 원격 저장소 force push 
$ git push -f origin {branch_name}
# 임시저장
$ git stash //저장
$ git stash list //저장목록 확인
$ git stash apply //최신 저장본으로 적용
출처:
https://gmlwjd9405.github.io/2018/05/25/git-add-cancle.html
gmlwjd9405.github.io/2018/05/18/git-stash.html