499 words
2 minutes
[Git] commit, push 제외 자주쓰는 git 명령어들
Branch 생성
git branch생성한 Branch로 이동
git switch example- branch를 만들면서 현재 branch 변경
git switch -c example2 # c 는 아마 create를 의미branch 삭제
git branch -d example- merge가 정상적으로 안되는 branch를 강제 삭제할 겨우
git branch -D example- 원격 브랜치를 삭제할 경우
git push origin --delete example파일옮기기, 이름 바꾸기
단순히 unix mv 명령어를 사용해도 된다.
git mv old_file new file커밋내역 확인하기
log를 통해 이전 커밋 내역을 확인한다.
git log커밋내역 삭제하기
git reset HEAD~n 최근 내역 n개 삭제git log # 삭제된 커밋 확인변경사항 복원하기
restore : 변경 내역이 있는 파일을 복원할 수 있다.
git restore a_file- stage 된 파일 복원
git restore --staged a_filebranch 합치기(merge)
- 여기서는 현재 branch의 commit을 대상이 되는 branch의 commit까지 옮기는 작업인
Fast Forward Merge만 다룬다. Fast Forward Merge는 중간에 다른 커밋이 추가되면 충돌 오류가 발생한다.
git switch examplegit merge example2References
관련 문서
- [[de-git-ssh_push|[Git]ssh passphrase없이 commit하기]]
tag overlap 1.00 - [[git-ssh_push|[Git]ssh passphrase없이 commit하기]]
tag overlap 1.00 - [[git-ssh_remote_add|[Git]원격저장소 추가하기]]
tag overlap 1.00 - [[git-submodule|[Git]Submodule]]
tag overlap 1.00
[Git] commit, push 제외 자주쓰는 git 명령어들
https://yjinheon.netlify.app/posts/02de/git/git-log/