git incoming and git outgoing

Version 0.2.0 Updated Sep 14, 2026

Preview branch movement before pulling or pushing. These commands intentionally match the core Mercurial incoming and outgoing semantics while using Git branches in place of Mercurial bookmarks:

  • git incoming and git in show commits reachable from the comparison ref and not reachable from HEAD.
  • git outgoing and git out show commits reachable from HEAD and not reachable from the comparison ref.

When no ref is provided, the comparison ref is the current branch's configured upstream, such as origin/feature/foo. If no upstream is configured, the command exits with code 2 and explains how to set an upstream or pass a ref.

# Fetch the upstream remote and show commits that would be pulled

git incoming
git in


# Fetch the upstream remote and show commits that would be pushed

git outgoing
git out

Pass an explicit ref to compare against something other than the current branch's upstream:

git incoming origin/main
git outgoing origin/release/1.2

By default, remote-backed comparison refs are fetched before comparison. Use --no-fetch to compare against the currently known local tracking ref without contacting the remote:

git incoming --no-fetch
git outgoing origin/main --no-fetch

Return codes 0 and 1 follow Mercurial's documented behaviour for these commands, while 2 is git-donkey's own code for a command that could not run:

  • 0 means matching incoming or outgoing commits were found and printed.
  • 1 means no matching commits were found.
  • 2 means the command could not run, such as when no upstream is configured and no explicit ref was provided, a configured upstream cannot be resolved, or when the fetch or comparison failed, so automation never mistakes a fetch failure for "no changes".