Search code examples
gitgithubgit-commit

What is exactly meaning of commit command in git


commit is

A commit, or "revision", is an individual change to a file (or set of files). It's like when you save a file, except with Git, every time you save it creates a unique ID (a.k.a. the "SHA" or "hash") that allows you to keep record of what changes were made when and by who. Commits usually contain a commit message which is a brief description of what changes were made.

but i didn't got it

What is exactly meaning of commit in git and git hub?

NOTE:-This not dupli of any Q I am clear about git push


Solution

  • After you do changes in your code you will do "commit".

    Commit set a message about the changes you were done. The commit also saves a revision of the code and you can revert the code to any version anytime in one click.

    All time the perfect example for this is like a tree. Source tree for more precisely. This will be the perfect to explain the git branch on the source tree:

    Git Sourcetree

    Every commit its a point on the "master", the master will be the tree trunk.

    You can add a branch to the tree and add more commit only on this branch. After the changes, you can merge the change to the master.

    So in summary, git is used as a code version manager. Knows how to deal with conflicts and combine several different versions into one version.

    And this is screen capture of comparing two different code versions (commits)

    comparing two different commits on PhpStorm IDE

    Hope I helped you :)