Review changes in Git
After rechecking the deposit details, Jerry realizes that the string length cannot be negative, so he decides to change the type of my_strlen function.
Jerry uses the git log command to observe the log details.
[jerry @ CentOS project] $ git log
The above command will produce the following result:
commit cbe1249b140dad24b2c35b15cc7e26a6f02d2277
Author: Jerry Mouse
Date: Wed Sep 11 08:05:26 2013 +0530
Implemented my_strlen function
Jerry uses the git show command to check the deposit details. Git specifies the command to be taken from the SHA-1 deposit ID as a parameter.
[jerry @ CentOS project] $ git show cbe1249b140dad24b2c35b15cc7e26a6f02d2277
The above command will produce the following result:
commit cbe1249b140dad24b2c35b15cc7e26a6f02d2277
Author: Jerry Mouse
Date: Wed Sep 11 08:05:26 2013 +0530
Implemented my_strlen function
diff --git a / string.cb / string.c
new file mode 100644
index 0000000.187afb9
--- / dev / null
+++ b / string.c
@@ -0,0 +1,24 @@
+ # include
+
+ int my_strlen (char * s)
+ {
+
char * p = s;
+
+
while (* p)
+ ++ p;
+ return (p -s);
+
}
+
He changes the type of function from int to size_t. After checking the code, he reviews the changes by running git diff.
[jerry @ CentOS project] $ git diff
The above command will produce the following result:
diff --git a / string.cb / string.c
index 187afb9.7da2992 100644
--- a / string.c
+++ b / string.c
@@ -1,6 +1,6 @@
#include
-int my_strlen (char * s)
+ size_t my_strlen (char * s)
{
char * p = s;
@@ -18,7 +18,7 @@ int main (void)
};
for (i = 0; i <2; ++ i)
{
- printf ("string lenght of% s =% dn", s [i], my_strlen (s [i]));
+ printf ("string lenght of% s =% lun", s [i], my_strlen (s [i]));
return 0;
}
Git diff indicates the '+' symbol before the lines that add new and adds '-' to the deleted lines.
According to Tutorialspoint
Previous article: Make changes in Git
Next article: Commit in Git
You should read it
- 10 Netsh commands of Windows Server 2008 should know
- Combine all the most basic AutoCAD commands
- All cmd and dos commands on Windows
- 7 commands to manipulate the most basic files and folders everyone must know
- Use commands and some tips for Mac OS X
- 5 Linux commands every sysadmin needs to know
- 15 Tar commands should try in Linux
- How to run 2 or more Terminal commands at the same time on Linux
May be interested
- Review HP Specter x360: Excellent 2-in-1 laptopthe specter x360 is one of the perfect laptops. updated with intel's 10th-generation processor and modernized chassis, the specter x360 retains the advantages of the previous version and upgrades it.
- Review Galaxy M51 camera : Quality image bold and full of attractioni personally find that the galaxy m51 camera is receiving a lot of attention from users. so, does the quality of photos taken from the mid-range samsung smartphone really bring satisfaction to the segment? let's review the galaxy m51 camera in detail.
- Review Sony Vaio Fvaio f owns a full hd display beautiful, powerful configuration, good sound but the touchpad is a bit small and the size is quite large.
- OnePlus Watch smartwatch reviewoneplus revealed the construction of an ecosystem that connects its products in 2019. that's right before the company launches its first tv product, the oneplus q1 pro.
- OysterVPN Review: Fast, Secure, and Budget-Friendlythe popularity of vpns varies wildly, but they are always a useful tool to have in your arsenal for protection from a number of security and privacy issues.
- Asus Zenbook 15 laptop review: Compact, comfortable keyboardzenbook 15 is a petite laptop with a 15.6-inch screen. although small, the asus zenbook 15 still contains 8th-generation intel whiskey lake core i7-8565u cpu and nvidia geforce gtx 1650 gpu.
- ExpressVPN Review: The best overall VPN todayexpressvpn is the best vpn provider in the class. this vpn offers the highest level of security and a large number of servers, spread over 94 countries.
- Lilo & Stitch Review: Unnecessary Remake or Successful Live-Action?changing things up enough to make the story different but still recognizable, lilo & stitch will be one of the big hits of summer 2025.
- Review who Thuong's movie is, the opposite of tears, .. on VTVvtv go is an application for watching online tv or reviewing vtv programs with many different topics, areas including current affairs, economics, culture, entertainment, sports, international, feature films.
- Galaxy A42 5G detailed review: What's the cheapest Samsung 5G phone available?thus, samsung's mid-range 5g smartphone galaxy a42 5g was launched and made many users interested up to the present time.