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 8576225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:52:47+00:00 2026-06-11T19:52:47+00:00

I’ve got a git alias that looks like this: [alias] unpushed = log origin..HEAD

  • 0

I’ve got a git alias that looks like this:

[alias]
        unpushed = log origin..HEAD --pretty=format:'%h %an %s'

Which works great for showing “unpushed” changes when I’m on master. But, this alias doesn’t really work right when I’m on a branch.

What would the correct command be to show unpushed changes whether or not I’m on a branch?

  • 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-11T19:52:48+00:00Added an answer on June 11, 2026 at 7:52 pm

    If you just want to see the outgoing commits for the current branch, you can use the following:

    git config alias.unpushed "log @{u}.. --pretty=format:'%h %an %s'"
    

    This causes git log to show all commits reachable from HEAD excluding those reachable from the upstream branch. The @{u}.. argument is equivalent to @{u}..HEAD, and @{u} is shorthand for the current branch’s upstream commit (e.g., origin/foo if the checked out branch is foo).

    If you want to see all unpushed commits from all branches, do this:

    git config alias.unpushed "log --all --not --remotes --tags --pretty=format:'%h %an %s'"
    

    The above causes git log to walk all references, but stop at (exclude) remote references (e.g., origin/master) and tags. Git doesn’t distinguish between local and remote tags, so the above assumes that all tags are remote (this isn’t always true, so you may want to leave out the --tags argument sometimes).

    I personally use the following aliases to show unpushed commits:

    # unpushed:  graph of everything excluding pushed/tag commits
    # with boundary commits (see below for 'git g' alias)
    git config alias.unpushed '!git g --not --remotes --tags'
    
    # go:  _G_raph of _O_utgoing commits with boundary commits
    # (see below for 'git gb' alias)
    git config alias.go '!git gb @{u}..'
    
    # g:  _G_raph of everything with boundary commits
    git config alias.g '!git gb --all'
    
    # gb:  _G_raph of current _B_ranch (or arguments) with boundary commits
    git config alias.gb '!git gbnb --boundary'
    
    # gbnb:  _G_raph of current _B_ranch (or arguments) with _N_o _B_oundary commits
    git config alias.gbnb 'log --graph --date-order --pretty=tformat:"%C(yellow)%h%Creset %C(magenta)%aE %ai%Creset %C(green bold)%d%Creset%n        %s"'
    

    For simple repositories I use the git g alias as my primary method of exploring the commits. For complex repositories (dozens of branches), I generally use git gb to show specific branches or ranges of commits. When I want to see how git push will change the remote reference (my push.default is set to upstream), I use git go. When I want to see if there is anything anywhere in my local repository I haven’t pushed (e.g., to see if I’ll lose work if I delete the clone), I use git unpushed.

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

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have an autohotkey script which looks up a word in a bilingual dictionary
I know there's a lot of other questions out there that deal with this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string

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.