52

Say if my project contains two masters (master and master_ios) and I want to see what the origin of a feature branch is (by origin, i mean the branch the feature branch is based off), how would I accomplish this in git?

samoz
  • 56,849
  • 55
  • 141
  • 195
dlucci
  • 729
  • 4
  • 9
  • 24

5 Answers5

52
git remote show origin

shows remote and local branches with tracking info.

xxxxx
  • 1,918
  • 2
  • 17
  • 22
  • 46
    this command only tells me, that my branch is tracked but not its origin. So how is this the answer to the question? –  Oct 17 '18 at 20:18
  • This command asks for a password if not authorized. Not suitable if you just want to get the remote URL. – Darrarski Feb 14 '22 at 11:25
  • @user8434768 In local branch section it shows the remote branch of your local branchs. – haj_baba Jun 11 '23 at 08:00
17

For people who just want to see all the remote urls

git remote -v

Daltron
  • 1,729
  • 3
  • 20
  • 37
11

Git does not track what branch a commit was created on and does not track where a branch was branched off from. There is no information in git that you can use answer that question.

source: https://community.atlassian.com/t5/Bitbucket-questions/Knowing-from-which-branch-the-current-branch-was-created-from/qaq-p/570135

1

What you're looking for is the Graph available on the Repository menu :

See screenshot

2

vimuth
  • 5,064
  • 33
  • 79
  • 116
yallouch
  • 21
  • 5
1
cat .git/config

will give you where you based your branch

Omer Sen
  • 49
  • 4