현재 git에서 소스 제어중인 모든 파일을 나열하는 방법이 있습니까? (수정 된 것만이 아닙니다).
답변
특정 브랜치에 대한 모든 파일을 나열하려면 다음과 같이하십시오 master
.
자식 ls-tree -r master-이름 만
이 -r
옵션을 사용하면 하위 디렉토리로 돌아가서 현재 버전 관리중인 각 파일을 인쇄 할 수 있습니다. 다른 분기의 목록을 가져 오는 HEAD
대신 지정할 master
수도 있습니다.
존재하는 모든 파일 목록을 얻으려면 여기를 참조하십시오 .
자식 로그 --pretty = format : --name-only --diff-filter = A | 정렬 -u
답변
git ls-files
명령은 당신이 필요로 할 것입니다.
출처 : http://www.kernel.org/pub/software/scm/git/docs/git-ls-files.html
답변
git ls-files
현재 작업 디렉토리의 파일 만 인쇄합니다.
예를 들어 dotfiles ( core.worktree = /
)에 대한 git repo 가있는 경우 git root 외부에 파일이 있으며 간단한 명령이 더 이상 작동하지 않습니다.
요컨대, 이것은 작동합니다 :
git --git-dir "`git rev-parse --git-dir`" \
-C "`git config core.worktree || pwd`" \
ls-files
예:
mkdir ~/dotfiles
cd ~/dotfiles
git config core.worktree /
# Ignore all files by default, else Git will find all files under "/"
echo "*" > .git/info/exclude
# Add files at the git repo's root and somewhere in the work tree
touch README
git add -f README
git add -f /etc/ssh/sshd_config
# `git status` would now print:
# new file: ../../../etc/ssh/sshd_config
# new file: README
git status
git commit -m "Initial commit"
# At this point, `git ls-files` prints only:
# README
git ls-files
# But you can print all files inside the work tree. This will print:
# etc/ssh/sshd_config
# home/yourusername/dotfiles/README
git --git-dir "`git rev-parse --git-dir`" -C "`git config core.worktree || pwd`" ls-files
현재 (쉘) 디렉토리를 기준으로 경로를 지정 하려면 다음 작업을 수행하십시오.
alias gls='git ls-tree -r master --name-only HEAD "`git config core.worktree`"'
위의 예에서는
README
../../../etc/ssh/sshd_config
답변
gitk
대화식 저장소 뷰어를 사용할 수도 있습니다 .
답변
이미지를 살펴보십시오. 오른쪽에는 패치와 트리의 두 가지 옵션이 있습니다. 트리를 선택하면 각 커밋에 대한 폴더 구조를 볼 수 있습니다.