How to get ONLY filename with path using git log?

后端 未结 3 1795
情深已故
情深已故 2020-12-20 23:22

I used almost all git log commands yet i haven\'t found a best way to do this. I need only this - get only file name with path nothing else

/path/filename.tx         


        
3条回答
  •  被撕碎了的回忆
    2020-12-20 23:57

    Use the --since and --until options to select the time range and then you can use UNIX pipes to grep, sort and collect the uniqe paths:

    git log --name-status --since='..' --until='..' | grep -E '^[A-Z]\b' | sort | uniq | sed -e 's/^\w\t*\ *//'
    

    Example:

    git log --name-status --since='1 January 2015' --until='2 January 2015' | grep -E '^[A-Z]\b' | sort | uniq | sed -e 's/^\w\t*\ *//'
    

    For more detailed git log outputs see How to have git log show filenames like svn log -v


    If you have two commit hashes, you can also use git diff and --name-only instead, as the other answer mentions:

    git diff hash1..hash2 --name-only
    

提交回复
热议问题