Commit in Git
Jerry commits (deposits) the changes and he wants to correct them for his recent commits. In this case, the function git commit -a will help do this. This function changes the last commit including your commit message; It creates a new commit ID.
Before custom operation, he checks the commit log.
[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
commit 19ae20683fc460db7d127cf201a1429523b0e319
Author: Tom Cat
Date: Wed Sep 11 07:32:56 2013 +0530
Initial commit
Jerry commits new changes to the --a function, and observes the commit log.
[jerry @ CentOS project] $ git status -s
M string.c
?? string
[jerry @ CentOS project] $ git add string.c
[jerry @ CentOS project] $ git status -s
M string.c
?? string
[jerry @ CentOS project] $ git commit --a -m 'Changed return type of my_strlen to size_t'
[master d1e19d3] Changed return type of my_strlen to size_t
1 files changed, 24 insertions (+), 0 deletions (-)
create mode 100644 string.c
Now git log will show a new commit message with the new commit ID:
[jerry @ CentOS project] $ git log
The above command will produce the following result:
commit d1e19d316224cddc437e3ed34ec3c931ad803958
Author: Jerry Mouse
Date: Wed Sep 11 08:05:26 2013 +0530
Changed return type of my_strlen to size_t
commit 19ae20683fc460db7d127cf201a1429523b0e319
Author: Tom Cat
Date: Wed Sep 11 07:32:56 2013 +0530
Initial commit
According to Tutorialspoint
Previous article: Review changes in Git
Next lesson: Push operation in HTML
4 ★ | 1 Vote
You should read it
- 20+ essential Linux security commands
- 10 useful commands in Windows you should know
- All cmd and dos commands on Windows
- How to use the command history function in Command Prompt
- Set command in Windows
- Del command in Windows
- 11 df commands in Linux (with example)
- 7 commands to manipulate the most basic files and folders everyone must know
May be interested
- How to Use Git Effectivelythis article explores the source code management and collaboration system called git and provides guidance on how to get the most value from git. git can be used as a local source code management system, and can also be used for...
- Uncover the unexpected mystery of the spy's 'double life'spy job is considered one of the most mysterious and dangerous professions in the world. spies are always under pressure because they have to hide their work from their wives and children, and must commit themselves to dangerous missions, sometimes not returning.
- People with autism are more likely to commit suicideresearchers say that people with autism tend to be dissatisfied with their lives because they feel socially distant and depressed. therefore, promoting social inclusion can save these people.
- Google recommends turning off 2G signals to prevent fraudaccording to google, turning off 2g signals helps prevent bad guys from taking advantage of the vulnerabilities of this old technology to commit fraud through distributing sms messages.
- More than 200 artists call for responsible use of artificial intelligence in the music industrya letter signed by more than 200 famous artists (including billie eilish, nicki minaj, stevie wonder,...) asked technology companies to commit not to develop intellectual tools. artificial intelligence (ai) to replace human creativity.
- Never use these types of SIMs!junk sims are a method for criminals to take advantage of and commit illegal acts such as calling and texting impersonating authorities and defrauding and appropriating property.
- It was GitHub's turn to be ransomedgithub has been hacked for more than a day, causing code and commit repositories to disappear.
- Cybercriminals are using Microsoft Teams calls to commit fraudcybercriminals are calling people over microsoft teams pretending to be a company and offering help, but they won't do anything.
- The 4 true stories show how scary identity theft can bein fact, being a victim of identity theft can be more frightening than many people imagine, you may even lose your identity or commit murder ...
- 12 things to avoid before thinking about getting richgetting rich doesn't want it but that will not always be met. there are people who, although hard at work, never seem to have a lot of money. the reason is because they make some unnecessary mistakes. if you want to consider getting rich, do not commit these 12 things!