git reset

git reset

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2020 Jan 9 14:28
Editor
Edited
Edited
2022 Jul 8 6:4

브랜치가 가르키는 버전을 바꾼다

  • remove 1 commit
git reset --hard <sha1-commit-id> git push origin HEAD --force
 
 
  • make 3 commit to 1
git reset --soft HEAD~3 && git commit
 
git reset --hard ORIG_HEAD //change branch referencex git reset --merge ORIG_HEAD
if argument is branch then refer reference of that branch (안연결될 놈들은 접근 못하기 때문에 삭제, 취소처럼 느껴지는거)
 
 
git reset --soft HEAD~{{commit count}} or or git reset --hard HEAD^ git reset --hard master@{"10 minutes ago"}
—hard make all delete, —soft just move
  • revert all
git reset --hard HEAD
 

if already pushed

git push origin HEAD --force
 
Reset VS Checkout - GIT4 - Reset & Revert
비슷한듯 다른 기능인 git reset과 git checkout을 비교함으로서 각각의 기능에 대해서 더 잘 이해해보는 시간입니다. git reset : 브랜치가 가르키는 버전을 바꾼다. git checkout : HEAD가 가르키는 것(브랜치나 버전)을 바꾼다. reset vs checkout 의 이론적인 비교 reset vs checkout 의 비교 실습 reset과 checkout을 댓글로 설명해보세요.
Reset VS Checkout - GIT4 - Reset & Revert
Delete commits from a branch in Git
I would like to know how to delete a commit. By delete, I mean it is as if I didn't make that commit, and when I do a push in the future, my changes will not push to the remote branch. I read git...
Delete commits from a branch in Git
 
 
 

 

Recommendations