Git는 .git에 지운작업조차 다 기록하고 있다. commit, push , pull, cherrypick, rebase..
git reflog 로 이력을 볼수 있다.
이력이 보이면 커밋아이디가 각각 존재하는데,
git reset --hard <7문자의커밋id>
하면 해당 커밋이 살아돌아온다.
git checkout -b <삭제한 브랜치명> <7문자의커밋id>
삭제했다고 울지말자!
This is slide 1 description. Go to Edit HTML and replace these sentences with your own words. This is a Blogger template by Lasantha - PremiumBloggerTemplates.com...
This is slide 2 description. Go to Edit HTML and replace these sentences with your own words. This is a Blogger template by Lasantha - PremiumBloggerTemplates.com...
This is slide 3 description. Go to Edit HTML and replace these sentences with your own words. This is a Blogger template by Lasantha - PremiumBloggerTemplates.com...
Git는 .git에 지운작업조차 다 기록하고 있다. commit, push , pull, cherrypick, rebase..
git reflog 로 이력을 볼수 있다.
이력이 보이면 커밋아이디가 각각 존재하는데,
git reset --hard <7문자의커밋id>
하면 해당 커밋이 살아돌아온다.
git checkout -b <삭제한 브랜치명> <7문자의커밋id>
삭제했다고 울지말자!
커밋을 하다보면 엇. 저파일이 왜 올라가 있지. 할때가 온다.
그때 같은 커밋에서 그 파일만 쏙 뺴고 싶을때는
git rebase -i HEAD^잘못올라간 커밋까지의 숫자(1부터 무한대)
하고 나서 숫자만큼의 커밋목록이 나타나면 파일을 없애고자 하는 커밋의 pick -> edit로 바꾼다.
git restore --source=HEAD^ --staged -- 파일경로/파일이름
하고 나면
git status 에 staged 된거랑 수정내용이 반영되어진 unstaged된거가 있다.
지울놈은 unstage된넘.(즉, 아래빨간놈)
git restore 파일경로/파일이름
하면 unstage상태에서 빠지고,
git rebase --continue
하면 git 가 해당 파일을 커밋에 유지할까 생각하다가 이커밋이전의 커밋하고 차이가 없으니까 커밋목록에서 제가한다.
ex)
git rebase -i HEAD^1
git restore --source=HEAD^ --staged -- . (또는 mysource/. , myfile.java)
git restore mysource/. (또는 myfile.java) <- 이부분에서 커밋에서 제외됨
git add mysource/otherfile.java (커밋을 유지하고 싶은 파일)
git commit --amend (하면 add했던 파일만 다시 올라와있음)
git rebase --continue
Merge 된 브랜치 취소하기
git reset --merge 60f3339(<-머지된 커밋)>> : 다른브랜치