Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To create a commit, save a change, select the files or edits you want included, then record them in your repository’s history. In a terminal, the basic sequence is git add followed by git commit. In GitHub Desktop, select the changed files, enter a summary, and click Commit to [branch]. A commit is saved locally; sending it to GitHub is a separate push or publish step.

What a commit does

A commit records a snapshot of selected changes at a point in time. Git gives each commit a unique identifier, called a SHA or hash, and associates it with information such as its author and creation time. The commit becomes part of the history of the branch you are working on.

Before making one, make and save a change in your project. If you cloned a repository, work inside that existing repository; you do not need to initialize it again. GitHub’s overview of GitHub and Git explains the basic concepts behind commits and repository history.

Make a commit from the command line

Open a terminal in your local repository. For a changed README file, use:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
git status
git add README.md
git commit -m "Add project overview"
  1. git status shows which files have changes and whether they are staged.

  2. git add README.md stages the README changes for the next commit. Replace README.md with the path to the file you changed.

  3. git commit -m "Add project overview" records the staged changes with the message in quotation marks.

Staging is a review step: only changes you stage are included in the next snapshot. For a first commit in a newly created repository, GitHub’s command-line guide shows the sequence of initializing the repository, creating a README, staging it, and committing it. You do not need the git init step if you have already cloned or initialized your repository.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check what you are about to commit

Use git status to see staged and unstaged files. Stage only the changes intended for this commit rather than adding unrelated work. If you need to inspect exactly what changed, review the file or diff before running git commit.

Commit changes in GitHub Desktop

  1. Open the repository in GitHub Desktop and edit a file in your preferred text editor.

  2. Save the file, then return to GitHub Desktop and open the Changes view.

  3. Review the changed-file list and select only the files you want in this commit. Deselect unrelated changes.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  4. Enter a short summary, such as Add project overview, in the summary field.

  5. Click Commit to [branch], where the button names the branch currently displayed in the app.

GitHub Desktop’s About GitHub Desktop documentation notes that its graphical workflow may be easier for people new to Git and GitHub than using the command line.

If you are starting with a new Desktop repository

GitHub Desktop can initialize a repository with a README, which creates an initial commit. If you see that commit in the history, you can make your first new authored commit by editing and saving a file, then following the Changes, file selection, summary, and commit steps above. GitHub’s first-repository tutorial covers creating a repository and making a change.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the workflow that fits the change

  • GitHub.com: For a small, straightforward file edit, you can make the change in the web interface and commit it there. See Editing files on GitHub.

  • GitHub Desktop: Useful if you prefer a graphical view of changed files and commit history and do not want to type Git commands.

  • Terminal: Useful if you want to learn Git’s explicit staging and commit commands, or if the project’s instructions use the command line.

For a contribution to someone else’s project, check its contribution guidelines and use the branch the project expects. GitHub’s Git command-line guide demonstrates creating a branch in its contribution workflow.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Write a clear first commit message

Keep the message concise and specific about what changed. For example, Add project overview or Fix spelling in README is more useful than a message such as changes. GitHub’s About commits recommends focused commits containing related changes, while its commit-history guidance emphasizes clear intent and context.

Some organizations or repositories enforce additional rules, such as requiring signed commits or an issue number in the message. Those are repository-specific settings, not universal requirements for a personal project. GitHub Desktop may warn about a rule and block a commit that does not meet it.

Push the commit so it appears on GitHub

Committing and pushing are different actions. A commit made in a local repository remains there until you send it to the remote GitHub repository. In GitHub Desktop, click Publish repository if the repository has not been published yet, or Push origin to send new commits from an already published repository.

From a terminal, the command-line guide’s new-repository example connects the local repository to GitHub as origin and then pushes the main branch with git push --set-upstream origin main. Use the remote and branch appropriate to your project; do not repeat setup commands for an existing repository that is already connected.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why can’t I see my commit on GitHub?

If you committed locally but cannot see the change on GitHub.com, check whether you pushed it. A local commit does not update the remote repository until you publish or push. Also confirm you are viewing the same repository and branch that received the commit.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.