Skip to content

How to Commit

This page walks through the actual mechanics of making a commit — staging changes, writing the message, and pushing it up. For guidance on what to put in the commit message, see Commits.

Commits can be made either through the terminal or through your JetBrains IDE (IntelliJ IDEA / Android Studio). Both are shown below — use whichever you're more comfortable with.

JetBrains IDE (IntelliJ IDEA / Android Studio)

1. Open the Commit tool window

Find it on the left-hand sidebar (usually labeled Commit), or open it with:

  • Windows/Linux: Ctrl+K
  • macOS: Cmd+K

2. Review your changes

The Commit window lists every modified, added, and deleted file in your working directory, grouped by changelist. Click any file to see its diff on the right before deciding whether to include it.

Reviewing changes in the Commit tool window

3. Select what to include

Check the box next to each file you want in this commit. You don't have to commit everything at once — uncheck anything you're not ready to commit yet, and it'll stay pending for a later commit.

4. Write your commit message

Type your message in the text box above the file list.

5. Commit, or Commit and Push

  • Commit — saves the commit locally only. You'll need to push separately later.
  • Commit and Push — saves the commit and pushes it to the remote in one step.

Both buttons are at the bottom of the Commit tool window.

Never commit directly to main

We don't have branch protection rules set up (requires a paid plan), so nothing stops you from pushing straight to main.

Always work on a feature branch and go through a PR—even for "tiny" changes.

Committing and pushing from IntelliJ

6. Confirm it pushed

Check the Git tool window (bottom toolbar) or run git log in the terminal to confirm your commit landed and pushed successfully.


Terminal

1. Check what's changed

Before committing, see what files you've modified:

git status

This shows you modified, added, and untracked files. It's good practice to check this before every commit so you know exactly what you're about to include.

If you want to see the line-by-line diff of what changed before staging:

git diff

3. Stage your files

Stage a specific file:

git add path/to/file

Stage multiple specific files:

git add path/to/file1 path/to/file2

Stage everything that's changed:

git add .

Tip: Prefer staging specific files over git add . when you have unrelated changes sitting in your working directory — this keeps commits focused on one logical change instead of bundling unrelated edits together.

4. Confirm what's staged

git status

Staged files show up in green (ready to commit). Anything still red/unstaged won't be included.

5. Commit

Never commit directly to main

We don't have branch protection rules set up (requires a paid plan), so nothing stops you from pushing straight to main.

Always work on a feature branch and go through a PR—even for "tiny" changes.

git commit -m "your commit message here"

For a longer, multi-line message (a summary line plus a more detailed body):

git commit -m "short summary" -m "longer explanation of what changed and why, if needed"

Or open your default editor to write a longer message:

git commit

6. Push your commit

git push

If this is the first push on a new branch, you'll need to set the upstream:

git push -u origin your-branch-name

After the first push, plain git push will work for that branch.


Common issues

"Everything up-to-date" but you expected changes to push You likely forgot to git add before committing, or committed on the wrong branch. Run git status and git log --oneline -5 to check.

Push rejected (non-fast-forward) Someone else pushed to the branch since you last pulled. Run:

git pull

to merge in the latest changes, resolve any conflicts if prompted, then push again.

Accidentally staged a file you didn't mean to

git restore --staged path/to/file

This unstages it without discarding your actual changes.