Make changes in Git
Jerry creates a copy of the repository on his machine and decides to perform basic operations. So he created the file string.c. After adding content, string.c will look like this:
#include int my_strlen ( char * s ) { char * p = s ; while (* p ) ++ p ; return ( p - s ); } int main ( void ) { int i ; char * s [] = { "Git tutorials" , "Tutorials Point" }; for ( i = 0 ; i < 2 ; ++ i ) printf ( "string lenght of %s = %dn" , s [ i ], my_strlen ( s [ i ])); return 0 ; }
He compiles and checks his code and everything works normally. Now he can add these changes to the repository safely.
Git adds active files to the staging area.
[jerry @ CentOS project] $ git status -s
?? string
?? string.c
[jerry @ CentOS project] $ git add string.c
Git is pointing a bookmark question before naming the file. Obviously these files are not part of Git, and that's why Git doesn't know what to do with these files. That's why, Git is pointing a bookmark question before naming the file.
Jerry has added files to the staging area, the git status command will show the files in this area.
[jerry @ CentOS project] $ git status -s
A string.c
?? string
To commit the changes, he uses the git commit command followed by the -m option. If we forget the -m option. Git will open a text editor, where we can write multiple commit information.
[jerry @ CentOS project] $ git commit -m 'Implemented my_strlen function'
The above command will produce the result:
[master cbe1249] Implemented my_strlen function
1 files changed, 24 insertions (+), 0 deletions (-)
create mode 100644 string.c
After committing to view the log details, he ran the git log command. It will display the information of all commits with deposit IDs, depositors, commit dates and SHA-1 hash of deposit.
[jerry @ CentOS project] $ git log
The above command will produce the result:
commit cbe1249b140dad24b2c35b15cc7e26a6f02d2277
Author: Jerry Mouse
Date: Wed Sep 11 08:05:26 2013 +0530
Implemented my_strlen function
commit 19ae20683fc460db7d127cf201a1429523b0e319
Author: Tom Cat
Date: Wed Sep 11 07:32:56 2013 +0530
Initial commit
According to Tutorialspoint
Last lesson: Clone activity in Git
Next article: Review changes in Git
You should read it
- Full list of HTTP status codes, HTTP Status Code
- Patch operation in Git
- How to Check Your iPhone's Unlock Status
- Check MD5 code, check MD5 code of any file on the computer quickly and accurately
- How to check MacBook battery status
- 8 methods to quickly check website status from Linux Terminal
- Instructions for checking the sign status of iOS firmware
- 5 ways to check hard drive effectively to help periodically check the hard drive
May be interested
- 6 How to prepare delicious oats for the elderly and the sickthe following article, tipsmake.com would like to introduce you 6 ways to make delicious, nutritious bird's nest for the elderly and the sick.
- A guide to making delicious and beautiful chocolates at homehere's how to make chocolate both simple and economical! try one of the following two methods to make your own beautiful chocolate candy at home!
- Ways to make smart mouse traps with simple household itemsdomestic insects and rodents not only cause economic losses but also cause the spread of many dangerous diseases. how to kill rats without harm or cost too much? please refer to a few ways to make smart mouse traps from simple household items below! surely the cousins will be terrified.
- Minecraft medicine recipe, how to make Minecraft medicineapparently players can make themselves a 'doctor' in minecraft by learning about potion recipes that can help you avoid danger or give you an advantage in certain situations.
- How to make Vietcombank Online cardnow, you can make vietcombank online card quickly and easily via this bank's website. with just a few simple steps as instructed below, you will have a convenient vietcombank atm card right away.
- 4 ways to make delicious cucumber saladcucumber salad is a delicious dish, easy to eat on hot days. here are 4 ways to make delicious cucumber salad, simple not only delicious but also help to lose weight, beautiful skin, please refer.
- How to make delicious meat stock shipbraised pork with rich flavor, greasy, fragrant quail eggs, thick viscous water to eat very rice, especially in the cold season. the following article will guide you how to cook delicious warehouse meat stock, right.
- Things that can make you look older than your actual ageaging is inevitable, but there are certain habits that can speed up the process without you even realizing it.
- How to make Techcombank Online cardinstead of having to go to the tecombank transaction office or branch to make a bank card, you can choose to make techcombank online card at home.
- Making homemade mango ice cream in 4 simple ways, no machine requiredhere are 4 simple ways to make mango ice cream, no machine, anyone can make at home to have a delicious fruit ice cream for family on summer day.