Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9187395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:45:26+00:00 2026-06-17T19:45:26+00:00

I have a git log command that allows me to see local commits that

  • 0

I have a git log command that allows me to see local commits that haven’t yet been pushed to the remote repository. It looks like this:

ahead = log origin/master..HEAD --graph --pretty=format:'%Cred%h%Creset %d %s %Cgreen(%cr)%Creset %Cblue[%an]%Creset' --abbrev-commit --date=relative

This works fine as long as you are on the master branch. What I would like is a variable that I could put in the command where master is now, so that the git ahead alias would run against that branch. Something like the zsh $(git_prompt_info) variable, but that can be used in a gitconfig file as part of an alias definition.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:45:27+00:00Added an answer on June 17, 2026 at 7:45 pm

    You are looking for @{u}:

    <refname>@{upstream}, e.g. master@{upstream}, @{u}

    The suffix @{upstream} to a ref (short form <refname>@{u}) refers to the branch the ref is set to build on top of. A missing ref defaults to the current branch.

    So your alias should look like this:

    ahead = log @{u}..HEAD --graph --pretty=format:'%Cred%h%Creset %d %s %Cgreen(%cr)%Creset %Cblue[%an]%Creset' --abbrev-commit --date=relative
    

    But I would recommend changing it to this:

    ahead = log @{u}...HEAD --graph --decorate --left-right --boundary --pretty=format:'%Cred%h%Creset %d %s %Cgreen(%cr)%Creset %Cblue[%an]%Creset' --abbrev-commit --date=relative
    

    This will show both commits in the remote that are missing locally as well as local comits that are missing in the remote.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a local Git project repository, and have created a remote repository followed
If I have a commit hash that has not yet been pushed to origin,
I have a largish (as in ~15,000 commits) Git repository, that seems to be
In my git log, I have 2 commits. How can I generate the difference
I have the following recent commits when I do git log --oneline...I want to
Is there any way to list commits that have been fetched, but not merged
I have setup hudson to check out from my remote git repository but i
lets say I have a commit Id 0678dd19c498ede50e7714505eb5af3a5494beef I tried git log command, which
I have a git command that I run to display my logs. It mostly
I have a git repository on an OS X server that used to work

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.