top of page

Git Commit

What Is Commit In Git ?

Git commit command is used to fetch updates from staging area to the repository.Staging allows us to continue in making changes to the repository,and when we want to share these changes to version control system,commit comes into the picture.It allows to record these changes.It's like a snapshot of the project.

Every commit recorded in the master branch of the repository.

After staging commit is the next step in git.

How to Commit First File/Changes in Git ?

To commit file the prior requirements are :

  • Create a git repository.(Refer link)

  • Create a file within same root folder.

  • Add the file in staging area.(Refer link)

Now let's commit a file :

  • Open Git Bash.

  • Navigate to the Git repository(gitsample).

  • Check status.

  • To commit,enter the command 'git commit'.

  • Now,if you are committing for the first time to the repository,it will show you an configuration error like this :

  • So to fix this error :

    • Configure user email : command  'git config ""'.

    • Configure user name : command 'git config "Your Name"'.

  • Now,again run the command 'git commit -m "message"'.At the place of message,you can enter desired meassage.

  • It won't show any error.

  • To check if the commit is success,run the command 'git log'.

Refer next page Introduction To GitHub

commit error.png
config to local git.png
git commit.png
git log.png
bottom of page