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
- Summary of the common Run CMD commands
- Summary of DOS commands in MS-DOS
- 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
- Run remote commands on Cisco routers from the computer
- Commands in CAD - Summary of the most complete AutoCAD command