git log에 svn log -v와 같은 파일 이름을 표시하는 방법
SVN의 로그에는 다음과 같이 각 커밋에서 변경된 파일의 파일 이름을 출력하는 "-v"모드가 있습니다.
jes5199 $ svn 로그 -v -------------------------------------------------- ---------------------- r1 | jes5199 | 2007-01-03 14:39:41 -0800 (2007 년 1 월 3 일 수요일) | 1 줄 변경된 경로 : / 저자 / 복사 / ChangeLog / EVOLUTION / 설치 / MacOSX
git의 각 커밋에서 변경된 파일 목록을 얻는 빠른 방법이 있습니까?
변경된 파일의 전체 경로 이름 :
git log --name-only
변경된 파일의 전체 경로 이름 및 상태 :
git log --name-status
축약 된 경로 이름 및 변경된 파일의 diffstat :
git log --stat
더 많은 옵션이 있습니다 . 문서를 확인하세요 .
참고 : 더 이상 사용되지 않으므로 대신 사용하십시오. git whatchanged
git log
신규 사용자는 대신 git-log [1]을 사용하는 것이 좋습니다. 이
whatchanged
명령은 기본적으로 git-log [1] 과 동일 하지만 기본적으로 원시 형식 diff 출력을 표시하고 병합을 건너 뜁니다.명령은 주로 역사적인 이유로 유지됩니다. 오래 전에 Git을 배운 많은 사람들이
git log
리눅스 커널 메일 링리스트를 읽어서 발명 한 손가락 을 타이핑하는 훈련을 받았습니다.
명령 git whatchanged --stat
을 사용 하여 커밋 메시지와 함께 각 커밋에서 변경된 파일 목록을 가져올 수 있습니다 .
참고 문헌
git show
또한 훌륭한 명령입니다.
그것은 일종의와 비슷 svn diff
하지만 커밋 GUID를 전달하고 그 차이를 볼 수 있습니다.
나머지 커밋 메시지없이 만 파일 이름을 얻으려면 다음을 사용할 수 있습니다.
git log --name-only --pretty=format: <branch name>
그런 다음 파일 이름을 포함하는 다양한 옵션을 사용하도록 확장 할 수 있습니다.
git log --name-status --pretty=format: <branch name>
git log --stat --pretty=format: <branch name>
이 방법을 사용할 때주의해야 할 점은 출력에 무시해야 할 빈 줄이 있다는 것입니다. 이것을 사용하면 로컬 브랜치에서 변경되었지만 아직 원격 브랜치로 푸시되지 않은 파일을보고 싶을 때 유용 할 수 있으며 원격 브랜치의 최신 파일이 이미 풀인되었다는 보장이 없습니다. 예를 들어 :
git log --name-only --pretty=format: my_local_branch --not origin/master
로컬 브랜치에서 변경되었지만 아직 원격의 마스터 브랜치에 병합되지 않은 모든 파일을 표시합니다.
변경된 파일에 대한 기록을 표시하기 위해 매일 이것을 사용합니다.
git log --stat --pretty=short --graph
짧게 유지하려면 다음 .gitconfig
을 수행 하여 별칭을 추가하십시오 .
git config --global alias.ls 'log --stat --pretty=short --graph'
나는 이것을 사용한다 :
git log --name-status <branch>..<branch> | grep -E '^[A-Z]\b' | sort | uniq
파일 목록과 상태 (추가, 수정, 삭제) 만 출력합니다.
A sites/api/branding/__init__.py
M sites/api/branding/wtv/mod.py
...
git diff --stat HEAD^!
shows changed files and added/removed line counts for the last commit (HEAD
).
It seems to me that there is no single command to get concise output consisting only of filenames and added and removed line counts for several commits at once, so I created my own bash script for that:
#!/bin/bash
for ((i=0; i<=$1; i++))
do
sha1=`git log -1 --skip=$i --pretty=format:%H`
echo "HEAD~$i $sha1"
git diff --stat HEAD~$(($i+1)) HEAD~$i
done
To be called eg. ./changed_files 99
to get the changes in a concise form from HEAD
to HEAD~99
. Can be piped eg. to less
.
I find the following is the ideal display for listing what files changed per commit in a concise format :
git log --pretty=oneline --graph --name-status
Another useful command would be git diff-tree <hash>
where hash can be also a hash range (denoted by <old>..<new>
notation). An output example:
$ git diff-tree HEAD
:040000 040000 8e09a be406 M myfile
The fields are:
source mode, dest mode, source hash, dest hash, status, filename
Statuses are the ones you would expect: D (deleted), A (added), M (modified) etc. See man page for full description.
I generally use these to get the logs :
$ git log --name-status --author='<Name of author>' --grep="<text from Commit message>"
$ git log --name-status --grep="<text from Commit message>"
참고URL : https://stackoverflow.com/questions/1230084/how-to-have-git-log-show-filenames-like-svn-log-v
'code' 카테고리의 다른 글
PowerShell에서 코드를 어떻게 주석 처리합니까? (0) | 2020.09.28 |
---|---|
병합을 완료하지 않았습니다 (MERGE_HEAD가 있음). (0) | 2020.09.28 |
C ++에서 POD 유형은 무엇입니까? (0) | 2020.09.28 |
JDK (JNI 공유 라이브러리)를로드하지 못했습니다. (0) | 2020.09.28 |
이벤트를 발생시킨 요소의 ID 가져 오기 (0) | 2020.09.28 |