A Git commit is a recorded snapshot of the staged files in a repository. Each commit has a unique SHA hash, an author, a timestamp, a message and a pointer to its parent commit, forming the project history.
Why it matters
Commits are the units of history you review, revert and search. A good one is small, focused and explained: when something breaks months later, git log and git blame show what changed and why. Because commits are chained by hash, history cannot be silently altered without changing the IDs that follow.
Example
$ git add cart.js
$ git commit -m "Round cart total to two decimals"
[main 3f2a9c1] Round cart total to two decimals
1 file changed, 2 insertions(+), 1 deletion(-)
The short ID 3f2a9c1 can later be used to inspect it with git show 3f2a9c1 or undo it with git revert 3f2a9c1.
Common mistakes
- Writing vague messages such as "fix stuff" that tell future readers nothing.
- Bundling unrelated changes into one commit, which makes it hard to revert one of them.
- Rewriting commits that others have already pulled.
Related
Get notified when this term updates
Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.
यह पेज सामान्य जानकारी है, जिसे हमारी संपादकीय टीम ने लिखा है और दस्तावेज़ीकरण बदलने पर अपडेट किया जाता है। सर्वर और प्रदाता अलग-अलग होते हैं, इसलिए बदलाव पहले सुरक्षित तरीके से जाँचें। देखें: संपादकीय नीति और अस्वीकरण.