How to get Git diff of the first commit?

前端 未结 3 888
清酒与你
清酒与你 2020-12-13 12:48

I created a repo, created a file inside it, put some content in the file, and committed the file. Now, I\'d like to see a diff of that commit, which should ideally show the

相关标签:
3条回答
  • 2020-12-13 13:31

    You can do:

    git diff 4b825dc642cb6eb9a060e54bf8d69288fbee4904 HEAD
    

    4b825dc642cb6eb9a060e54bf8d69288fbee4904 is the id of the "empty tree" in Git and it's always available in every repository.

    0 讨论(0)
  • 2020-12-13 13:41

    Maybe try with:

    git log -p -n 1
    
    0 讨论(0)
  • 2020-12-13 13:46

    you can try:

    git show <first-commit-sha>

    or if you only have 1 commit you can simply use:

    git show HEAD

    0 讨论(0)
提交回复
热议问题