Commit changes to a Git Repository


In this tutorial, let’s learn the steps involved to commit changes to a git repository.

git status

git status is an inspection command to know the state of the working directory and the stating area. This command lets us to know which files are staged and which files are not tracked by the Git.

git status command


git add

git add command is used to add new files to the Git staging area.

git add

git commit

We can use git commit command to commit the new files and changes to the Git repository. The first initial commit might fail with the following error. We need to specify the git client with the credentials that would be linked to the commits.

$ git commit -m "Initial commit"
*** Please tell me who you are.
Run git config --global "[email protected]" git config --global "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.


$ git config –global “<your email address”

$ git config –global “<your name goes here>”


Git commit success


Pushing changes