For example, you modified the code locally and submitted it more than 20 times. Now you want to push these codes, and you want to check the code again, but you need to count, which files have been modified in these 20 commits? What changes were made to each file?
At this time, you need to use this command to easily view the list and differences of all modified files.
List all modified files, but do not show differences.
Lists all modified files and displays all modification differences.
This is the most appropriate answer I have found so far:
git log
You can specify time range, start and end commits, file paths, branches/labels and other conditions, and you can filter the output results to easily meet your first requirement.git show
或者git diff
can meet your second requirement, the parameters used will be different.I won’t tell you the specific commands, just read the documentation yourself.
But I can give you a trick. If you think the span of commits is a problem, you can create a new temporary branch, and then perform interactive rebase (squash all commit) forward to the initial commit you want to compare. In this way, you need There are only two commits to compare, one is the starting point, and the other is the sum of the subsequent n commits.
In fact, I think I should download a Github client. It is very intuitive and convenient to use. It has been updated recently. The workflow diagram of the new project. I am using the Windows version. I don’t know about the Mac version...
For file differences, use the client....sourceTree
git diff commit1 commit2 --name-status
git diff commit1 commit2
For a comparison of the committed content, see @910JQK’s answer
Contents that have not been committed but have been added can be used
git diff --cached