0

I have created a new local branch, but after spending some time on the branch, it is easy to forget the origin branch of the local branch. How can this be tracked down or searched up?

Nithraw
  • 67
  • 1
  • 8
  • Do you want the upstream branch that your local branch is pointing to? If so git branch -vv – Sam Daniel Nov 06 '17 at 08:14
  • Just a comment on your terminology - once you've created a new local branch, there really isn't any preference for the original (parent one). You could delete the "original" and leave only the new one. The only possible preference is creation date - until the split point they are in fact, the same branch (in a sense). – kabanus Nov 06 '17 at 08:15
  • possible duplicate of https://stackoverflow.com/questions/3161204/find-the-parent-branch-of-a-git-branch – Hrishi Nov 07 '17 at 08:12
  • Possible duplicate of [Find the parent branch of a Git branch](https://stackoverflow.com/questions/3161204/find-the-parent-branch-of-a-git-branch) – Hrishi Nov 07 '17 at 08:13

2 Answers2

0

List the remote branches will solve it

git branch -ar

Jinna Balu
  • 6,747
  • 38
  • 47
0
git reflog <local_branch> | tail -1

This entry tells from which revision the local branch was created. The revision could be a commit or a ref. The reflogs are just local and can't be pushed or fetched by default. The reflogs of branches are recorded in the files under .git/logs/refs/heads/. You could backup or track these logs if necessary.

ElpieKay
  • 27,194
  • 6
  • 32
  • 53