[git] View the modification history of a file

Sometimes when I compare the code, I see some changes, but I don't know the author and reason of the change, and I don't know the corresponding bug number, which means that I can't find out the specific reasons for these changes~

[Note]: a certain There are a limited number of changes to a file, and each code modification submission will have a commit description, we can start from here;

1. Switch to the directory

First switch to the directory where the file to be viewed is located:

cd packages/apps/Mms /src/com/android/mms/ui/

Second, git log --pretty

and then use the following command to list all the change history of the file, note that this focuses on a specific file, not a git library, if it is a library , then there are more changes ~

git log --pretty=oneline file name
such as :

copy code
root@ubuntu:android_src/packages/apps/Mms/src/com/android/mms/ui# git log --pretty= oneline MessageItem.java
27209385caf678abe878375a470f4edd67a2d806 fix to process force close when empty address contained in card
0e04b16f1dad7dc0a36e2235f7337bc656c365c7 display for 1970-1-1
e4abf3a213197491e0855e101117b59b5dc0160d HREF#13954 receive, store, and display wap push
356f6def9d3fb7f3b9032ff5aa4b9110d4cca87e HREF#16265_uim_show_time_error
350f9d34c35ab50bdb4b2d43fb3ff9780e6c73fa fix xxxx
715e32f97bd9d8ce4b5ba650b97ba4b137150456 Fix ANR from calling Contact.get()
fd8357ff5febab0141e1beb8dd3b26f70416b108 Fix missing From field
d130e2e6dc448fd80ecb70f0d31e3affb9888b9a fix bug 2112925: don't display zip file garbage content in MMS.
0e19f738c114f86d0d88825ee48966015fb48b6d Don't always show sent timestamp
52f854cbb75e8f9975c7e33216b828eb2f981095 Don't show Anonymous as the MMS sender
331864544ec51ba6807fc5471cc6d537b7fef198 add search capability
33a87f96f8c625aa10131a77a3968c97c4ec5a62 Remove all references to ContactInfoCache except those in Contact.
70c73e05a792832aa28da751cdaf3fa83a7b8113 Begin moving all conversation data behind a data model with a cache.
48da875f1beea835c6771977e5bd8a9aa3d4bc10 Begin adding UI unit tests to the Mms app.
66dde9460badebf8e740275cabde9cca256006eb Stop requiring a Context to be passed in to ContactInfoCache.
591d17e9a51bb9f829d6860dc7aa0bad25062cd5 auto import from //branches/cupcake_rel/...@138607
72735c62aba8fd2a9420a0f9f83d22543e3c164f auto import from //depot/cupcake/@135843
892f2c5bf965b1431ae107b602444a93f4aad4a3 auto import from //depot/cupcake/@135843
153ae99e0a7d626a24d61475eeb133249deb448c auto import from //depot/cupcake/@132589
// Depot Auto Import from abd7b2d90f7491075f1daba4b4cccdfc82f8ddd1 / Cupcake / @ 137
055 59d72c57ce9c319b6cd43ce2ab36b7076c9e821f Auto Import from //branches/cupcake/...@132276
44cea74dc55e2459262d0d765ef4a69267dd09b0 Auto Import from //branches/cupcake/...@131421
0f236f55349f070ac94e12cca963847173393da8 Code // drop from branches / cupcake/...@124589
8eed706474910ccb978acda03e85d3261037da6e Initial Contribution
Copy code
3. git show


as shown above, the print out is all the change history for the file MessageItem.java, the long string of numbers at the front of each line is the formation of each submission The hash value of , then use git show to display the modification of a specific change~

git show 356f6def9d3fb7f3b9032ff5aa4b9110d4cca87e The result is
as follows:


root@ubuntu:/android_src/packages/apps/Mms/src/com/android/mms/ui# git show 356f6def9d3fb7f3b9032ff5aa4b9110d4cca87e
commit
356f6def9d3fb7f3b9032ff5aa4b9110d4cca87e
2011 +0800

    Modified description (filled in when the code is committed)
   
    Signed-off-by: XX < XX's mailbox>

diff --git a/src/com/android/mms/ui/MessageItem.java b/src/com/android/mms/ui/MessageItem.java
index 0a0c4b7..55c3b27 100644
--- a/src/com/android/mms/ui/MessageItem.java
+++ b/src/com/android/ mms/ui/MessageItem.java
+
+ List the specific changes
-
-copy the
code
so that you can know who made the modification and the specific modification code~

Then whether you go directly to him to communicate or study the code, there are based on~

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326114170&siteId=291194637
Recommended