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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:20:49+00:00 2026-06-16T05:20:49+00:00

I used this command to check out a local branch ‘mylocal’ from remote branch

  • 0

I used this command to check out a local branch ‘mylocal’ from remote branch ‘origin/mater’.

git checkout -b mylocal origin/master

But, after awhile I forgot from which remote branch I created my local branch ‘mylocal’.

Is there any git command that I can use to show the corresponding remote branch for my local branch?

Thanks.

  • 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-16T05:20:50+00:00Added an answer on June 16, 2026 at 5:20 am

    If you have upstream information set up for your branch (which git may or may not have done automatically, depending on configuration) then you can use

    git rev-parse --symbolic-full-name --abbrev-ref mylocal@{u}
    

    This should output the remote branch that it was created from. If such information does not exist, then you’re just going to have to compare your branch with the remote branches to see which diverges the most. git show-branch -a might give you the information you want. Alternatively you can do something like git rev-list origin/master..mylocal | wc -l to get a count of how many commits away from origin/master you are, and do this with all the remote branches until you find the smallest distance.

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

Sidebar

Related Questions

I just checked out an earlier commit from my local git repo. I haven't
I am mostly following this page: http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html I used this command to create the
I need to revert local changes for deployments. (I'd used svn revert for this
This is the command I used: mysql> mysql -u root -p -h HOST sample
i used this code: List<string> lists=new List<string>(apple,orange,banana,apple,mang0,orange); string names; names=lists.Distinct() is that correct?
I used this MSDN example to construct my console host app: http://msdn.microsoft.com/en-us/library/ms731758.aspx It works
I used this tutorial to create a basic Javascript function for implementing change during
i used this script to animate some divs with jquery and css. now i
I used this link to create a SHA1 hash for any data using C++.
I used this selector in a function and I don't even know exactly what

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.