기타

Sep 12, 2022 - git 관련 은근히 자주 쓰는 command

jongviet 2022. 9. 12. 17:48

#source tree 고장나서 미친듯이 뻗을 때.. stash cli

git stash
git stash list
git stash apply {stashId} // 리스트에 뜨는 stash@{0} 과 같은 아이디!!
git stash drop {stashId}

 

#특정 commit만 반영

git cherry-pick {commit id} // 특정 커밋만 바로 로컬로 가져오기
git cherry-pick -n {commit id} // 특정 커밋을 반영하고 add까지 수행

 

git cherry-pick -n aaa123
git cherry-pick -n bbb123
git cherry-pick -n ccc123
git commit -m "cherry commit" // 여러 커밋 add후 한꺼번에 commit

 

#특정 commit hard reset

git reset --hard {커밋명} // 깃 코드 아예 삭제, 개인 프로젝트나..  확실할때만 사용...

 

#remote repo에 푸시 이후 gitignore 파일 재적용

git rm -r --cached .
git add .
git commit -m ".gitignore applied"
git push