0

In Git, how could I search for path of directory where particular branch is created..?

Actually there is a git branch on which all the changes were carried out. Now i wanted to know on which directory the branch is created(so that i can track the folder paths), is there any way to grep the git for directory path? currently i have to move to each directory and have to manual test the same using git branch -a. i refer this question

Community
  • 1
  • 1
rk_P
  • 230
  • 1
  • 3
  • 12
  • 3
    I have a feeling you are mixing up branch and directory trees. A branch isn't a folder, it's a snapshot of your whole working tree (i.e. it's a reference on a commit, which in turn points on the root tree of your working directory). Could you rephrase? – Sébastien Dawans May 31 '13 at 08:33

1 Answers1

0

Branches are not created on a directory. Branches are created at some commit.

Assuming that the branch is call your-branch and that is was created at some point on master, and there are no merges, you could git merge-base master your-branch to find the commit. This will find the common ancestor.

This was covered in this link.

If your-branch has merges, the command above will not be the creation commit. If this is the case you can do git reflog show --no-abbrev your-branch | tail -1 | sed 's/ .*//'. This only works for local branches.

Community
  • 1
  • 1
cforbish
  • 8,567
  • 3
  • 28
  • 32