This article will explain the method to commit a change including the desired commit “message” and “description” using the command line.
How to Commit a Change/Modification with Both Commit “message” and “description” in Git Using the Command Line?
To commit a change including “message” and “description”, follow the below-provided steps.
- Redirect to the local directory.
- Make changes in a particular file.
- Add changes to the Git index.
- Commit changes using the “git commit -m <message> -m <description>” command.
- Verify committed changes.
Step 1: Switch to Local Repository
First, redirect to the desired local directory by typing out the below-provided command:
Step 2: Update File
Then, use the “echo” command and update the content of the existing file in the repository:
Step 3: Stage Changes
Next, add new changes to the file to the Git staging area:
Step 4: Commit Changes With Message and Description
Now, execute the “git commit” command along with the desired commit message and description to commit new changes:
Step 5: Verify Changes
Lastly, ensure whether the changes have been committed with the message and description by viewing the Git log:
In the below-provided screenshot, the commit message and description can be seen:
We have demonstrated the procedure of committing a change with desired commit message and description from the command line.
Conclusion
To commit a change including “message” and “description”, first, navigate to the desired local repository. Then, make changes in a particular file and add changes to the Git index. Next, run the “git commit -m <message> -m <description>” command to commit changes with the message and description. Lastly, view Git log to verify committed changes. This article has explained the method to commit changes/modifications with the desired commit message and description in Git using the command line.