7

I was trying to find out when a certain feature branch in one of my repositories was created and I found that surprisingly hard. I ended up using a combination of git show-branch and git log.

Is there any easier way to find this little piece of information quickly and efficiently from the command line?

innaM
  • 46,211
  • 4
  • 64
  • 85
  • 1
    [How to determine when a Git branch was created?](http://stackoverflow.com/q/2255416/995714), [find out when a git branch was created](http://stackoverflow.com/q/18277841/995714) – phuclv Apr 24 '17 at 06:28
  • 2
    Possible duplicate of [How to determine when a Git branch was created?](http://stackoverflow.com/questions/2255416/how-to-determine-when-a-git-branch-was-created) – phuclv Apr 24 '17 at 06:29

1 Answers1

13
git show $(git merge-base master your-branch)

will show the commit where your branch branched off master

knittl
  • 197,664
  • 43
  • 269
  • 318
  • 1
    I believe this only works if `your-branch` hasn't been merged with `master`. If this is the case, then won't this show when the branch was last merged? – Michael Mior Dec 28 '11 at 10:18
  • 1
    @MichaelMior: yes, correct. But with Git if your branch has been merged, you cannot know if it was the same branch or a different branch (You might as well have created a new branch on top of the old one). You will only get the most current (meaningful) merge-base. Think of _branch_ as _not contained in trunk (master)_ – knittl Dec 28 '11 at 18:23