[LINUX] git 명령어 정리

문연수·2025년 8월 21일
0

Linux (Fedora)

목록 보기
29/29

필자가 자주 사용하는 git 명령어를 정리했다.

1. commit 에디터 변경

git config --global core.editor "lvim"

2. 특정 라인의 코드만 staging

git add -p
  • y: stage this hunk
  • n: do not stage this hunk
  • q: quit
  • a: stage this hunk and all later hunks in the file
  • d: do not stage this hunk or any of the later hunks in the file
  • e: manually edit the current hunk
  • s: split the current hunk into smaller hunks

3. branch 타임라인 시각화해서 보기

git show-branch --topo-order --sparse --list

4. rename 에 대해서도 추적하기

git log --follow <file>

 파일의 경로가 변경된 경우, 커밋 로그가 최종 위치에서 짤리는 경우가 있는데 --follow 를 주면 이전 경로에서의 로그까지 다 볼 수 있다.

profile
2000.11.30

0개의 댓글