Learning Git: What is a Commit?

Learning Git: What is a Commit?

Beginner Git Tutorial Video

Commits are fundamental to Git, but not all developers have a comprehensive understanding of what a commit actually is and how it gets applied to your project.

In short, a commit is a snapshot of your Git repository at one point in time. In this beginner Git tutorial video, we will dig into the journey of creating a commit. 

If you haven’t already started using the GitKraken Git GUI to visualize your commit history, download it for free now!

Download GitKraken Free

Git: Working vs Staging Directory 

To fully understand commits, we need to start by talking about your working directory vs your staging directory. 

working vs staging directory

Your working directory is your active work area, and files created or modified here do not yet affect your project. When you modify, add, delete, or rename a file here, that change is not immediately stored in the repository. It only exists locally in the working directory on your machine. 

In order for your changes to be reflected, you must stage them. Once file changes have been staged, they can be saved in the repository by performing a commit. 


Each commit becomes a snapshot of your repository from that point in time, and all of your commits will cumulatively form your repo’s history. 


Git Workflow: Make, Stage, Commit 

A typical Git workflow involves: 

  • Making changes
  • Staging changes
  • Committing changes 

Making File Changes in GitKraken

When you modify, add, delete, or rename any files in your working directory in GitKraken, your Work in Progress (WIP) will display at the top of the graph. 

When you click the WIP node, GitKraken shows you a list of the affected files in the Commit Panel on the right side of the UI, along with color-coded icons denoting the change type (modified, added, renamed, deleted).

WIP to commit in GitKraken

Staging File Changes in GitKraken 

GitKraken makes it quick and easy to stage file changes. Click on your WIP node and navigate to the Commit Panel. Simply hover over a file and click Stage File

staging in GitKraken

You may also click the file to view the diff, where you can choose to stage individual lines or hunks of the file. 

Furthermore, entire files, hunks, or lines can be unstaged or discarded with the click of a button. 

Discard all file changes to a given file by right-clicking and selecting Discard Changes, or discard changes to ALL files in your WIP by clicking the trashcan icon 🗑at the top of the Commit Panel. 

Psst: don’t fear! The handy GitKraken Undo button has your back if file changes are ever discarded by mistake. 

Committing Changes in GitKraken 

Ready to commit? When you’re satisfied with your staged changes, be sure to type a commit summary and description before clicking the button to commit your changes. You can also use the keyboard shortcut Cmd/Ctrl + Enter

committing changes in GitKraken

This will transform your WIP node into a commit that can be clicked for future review of the changes made at this specific point in time. 

Scroll through the central commit graph in GitKraken to see an overview of your project history, and click through other commits to review snapshots of file changes from other points in time. 

If you enjoyed this video, subscribe to the GitKraken YouTube channel to stay up-to-date on all of our learning Git tutorials, and check out our Learn Git Center to see an extended list of our educational resources. 

Stay on the cutting edge of software development by getting innovative tips, trends and stories delivered to your inbox every month!

Agile project management software
Plan, develop, review, and ship fast

Visit Axosoft.com

Legendary suite of developer tools
GitKraken Git GUI, Boards & Timelines

Visit GitKraken.com