On your Mac, open Terminal, go to the repository, and run git status -sb. If the current branch shows ahead 1 (or another positive number) relative to its upstream, it has local commits not represented by the remote-tracking branch Git is comparing against. Fetch first to refresh that comparison, then list the specific commits. This checks committed history; edits that have not been committed are a separate kind of local change.

Check the current branch against its remote-tracking branch

In Terminal, change to the project folder. You can type cd , drag the folder from Finder into the Terminal window, then press Return. Run:

git status -sb

A result such as ## main...origin/main [ahead 2] means the local main has two commits ahead of its configured upstream, origin/main, based on Git’s most recently recorded remote state. [behind 1] means the tracked remote branch has one commit absent locally. If both counts appear, the branches have diverged. Git documents that status can show ahead and behind counts when an upstream is set and available for comparison. Git status documentation

For the full status, use git status. It also reports changes in the working tree and staging area. Those modified or untracked files are not proof of unpushed commits: they are not commits yet. A clean working tree can still have unpushed commits, and a dirty one can have none.

Refresh the comparison, then inspect the commits

The origin/main name is a local remote-tracking reference; it is not a live view of the server. Run a fetch to update references from configured remotes, then check the status again:

git fetch
git status -sb

git fetch updates remote-tracking information without merging those fetched changes into your current branch. It does not push local commits. Fetch may fail if the remote cannot be reached or authentication is unavailable; in that case, the old comparison cannot tell you what is on the server now. Git fetch documentation

If status shows the branch is ahead and has an upstream, display the commits that are reachable from your current branch but not from that upstream:

git log --oneline '@{u}..HEAD'

Each output line is a commit; the first is the newest in the range. An empty result means Git found no commits in that range. The @{u} shorthand means the current branch’s configured upstream, and the two-dot range selects commits reachable from HEAD but not the upstream. Git revisions documentation

For example, if status says [ahead 2] and the log lists two commit subjects, those are the commits locally ahead of the tracked branch. This is a useful confirmation before deciding whether you intend to push them. It does not itself send anything.

If Git cannot compare the branch

If git status -sb shows no ahead/behind counts, the branch may have no configured upstream. Run:

git branch -vv

The current branch is marked with *; the bracketed text, when present, identifies its upstream and divergence counts. If there is no upstream shown, Git does not have the usual tracking reference for this comparison. git remote -v can show configured remote names and URLs, but it does not establish which remote branch is the intended destination. Git documents upstreams as optional branch settings used by commands such as status. Git pull documentation

Avoid guessing origin/main: your branch could track a differently named branch or a different remote. If you know the intended remote branch, compare explicitly after fetching, replacing origin/main with its actual name:

git log --oneline origin/main..HEAD

This lists commits present in your current HEAD but absent from that reference. If the destination is uncertain, inspect the branch and remote configuration before treating the result as a push preview. Git allows the configured push destination to differ from the upstream used for comparison. Git revisions documentation

What this check does and does not establish

The comparison is only as current as the last successful fetch. Another person could push new commits after your fetch, or the server could change before you push. A successful fetch gives Git a fresher reference; it does not guarantee that a later push will succeed. Likewise, a commit absent from origin/main is not necessarily absent from every remote or branch.

When you have confirmed the intended destination and want to send the commits, use the push command appropriate to your repository’s branch and remote setup. If Git reports that no upstream is configured, it may require an explicit remote and branch; check the destination carefully before pushing. The steps above identify the local-versus-tracked history so you can make that decision without confusing uncommitted file edits with commits.

Sources