{"thread":{"id":"23048","subject":"Getting a branch's time of creation","startedAt":"2010-03-17T14:45:07Z","lastAt":"2010-03-19T20:54:41Z","messageCount":4,"participants":["jateeq","Randal L. Schwartz","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"137016","messageId":"27933166.post@talk.nabble.com","threadId":"23048","inReplyTo":null,"subject":"Getting a branch's time of creation","fromName":"jateeq","fromEmail":"jawad_atiq@hotmail.com","sentAt":"2010-03-17T14:45:07Z","receivedAt":"2010-03-17T14:45:07Z","isPatch":false,"sender":{"key":"jawad_atiq@hotmail.com","avatar":null},"body":"\nHello,\n\nI am trying to find the time at which a remote branch was created, so that I\ncan use the '--since' option in git log to limit the commits to only ones\nthat were created for that branch (read below to see why I can't use 'git\nlog <branchnname>). So my question: does git remember the time at which a\nbranch was created, and how can it be listed?\n\nNOTE: Once I clone a repository that contains Branch1 (which will have its\nown commits as well as commits from the master branch), I create Branch2 in\nthe clone to track Branch1. Branch1 will have commits before the cloning,\nand Branch2 will have its own commits after the cloning, but I want to list\nboth. The way I am thinking of doing it is to list all commits for Branch2,\nand then limit the commits to only ones that were created after Branch1 was\ncreated.\n\nIf anyone has suggestions on doing this alternatively, feel free to pitch\nin. Thank you.\nJawad.\n\n-- \nView this message in context: http://old.nabble.com/Getting-a-branch%27s-time-of-creation-tp27933166p27933166.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"137032","messageId":"86wrxakiyj.fsf@blue.stonehenge.com","threadId":"23048","inReplyTo":"27933166.post@talk.nabble.com","subject":"Re: Getting a branch's time of creation","fromName":"Randal L. Schwartz","fromEmail":"merlyn@stonehenge.com","sentAt":"2010-03-17T16:32:04Z","receivedAt":"2010-03-17T16:32:04Z","isPatch":false,"sender":{"key":"merlyn@stonehenge.com","avatar":"https://gravatar.com/avatar/dc528d210743ff0333e6213f9ee7b33b23f1b7bc1f3c5a8c2d819074ecd7ab19?d=mp&s=160"},"body":">>>>> \"jateeq\" == jateeq  <jawad_atiq@hotmail.com> writes:\n\njateeq> I am trying to find the time at which a remote branch was created, so\njateeq> that I can use the '--since' option in git log to limit the commits to\njateeq> only ones that were created for that branch (read below to see why I\njateeq> can't use 'git log <branchnname>). So my question: does git remember\njateeq> the time at which a branch was created, and how can it be listed?\n\nYou're probably looking for the commit at the common ancestor\nof a given branch (which is a point, not a line, remember) and a branch\nyou're interested in, like maybe \"master\".\n\nconsider something like:\n\ngit log $(git merge-base origin/somebranch origin/master)..origin/master\n\n-- \nRandal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095\n<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>\nSmalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.\nSee http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion\n"},{"id":"137041","messageId":"1268846646146-4751743.post@n2.nabble.com","threadId":"23048","inReplyTo":"86wrxakiyj.fsf@blue.stonehenge.com","subject":"Re: Getting a branch's time of creation","fromName":"jateeq","fromEmail":"jawad_atiq@hotmail.com","sentAt":"2010-03-17T17:24:06Z","receivedAt":"2010-03-17T17:24:06Z","isPatch":false,"sender":{"key":"jawad_atiq@hotmail.com","avatar":null},"body":"\nGreat, that works -  it gives me the commit that Branch 1 was at at the time\nof cloning.\n\nOne concern however. If I clone the repository, create Branch 2 to track\nBranch 1, and in the mean while push changes to the master branch of the\nrepository, the commit that this command gives me changes (to the last\ncommit that was pushed). The repository I am cloning from is bare, so in\norder to make changes to the master, I clone it again, make changes to the\nmaster branch of the clone and push those back (of course, this clone also\nhas Branch 1 as a remote branch, but I am not making changes to it). What is\ngit doing? Why does it change the commit history of Branch 1 when I did not\npush changes to it? \n\nBefore pushing to master:\n$git log --oneline $(git merge-base origin/jateeq.2010-03-16.15-32\norigin/master)..origin/master\n610cfae added file.xml\n\nAfter pushing to master:\n$git log --oneline $(git merge-base origin/jateeq.2010-03-16.15-32\norigin/master)..origin/master\n9070a4d removed fcc.xml\n\n\nThanks, \nJawad\n-- \nView this message in context: http://n2.nabble.com/Getting-a-branch-s-time-of-creation-tp4750687p4751743.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"137268","messageId":"m3pr30jan6.fsf@localhost.localdomain","threadId":"23048","inReplyTo":"27933166.post@talk.nabble.com","subject":"Re: Getting a branch's time of creation","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-03-19T20:54:41Z","receivedAt":"2010-03-19T20:54:41Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"jateeq <jawad_atiq@hotmail.com> writes:\n\n> I am trying to find the time at which a remote branch was created, so that I\n> can use the '--since' option in git log to limit the commits to only ones\n> that were created for that branch (read below to see why I can't use 'git\n> log <branchnname>). So my question: does git remember the time at which a\n> branch was created, and how can it be listed?\n[...]\n\n> If anyone has suggestions on doing this alternatively, feel free to pitch\n> in. Thank you.\n\nIt looks like an XY problem to me: you are asking how to get about\nspecific solution, instead of about how to solve a problem.\n\nIf you know what branch was remote branch created from, you can simply\nuse\n\n  $ git log <base>..<branch>\n\nwhich translates into\n\n  $ git log <branch> ^<base>\n\nwhich means everything in <branch> that is not present in <base>.\n(Assuming that <branch> is the branch you are interested in, and\n<base> is the branch it was branched off).\n\n<base> might be result of \"git config --get branch.<branch>.merge\"\n(if the upstream was correctly configured).\n\nYou can also get branching point with\n\n  $ git merge-base --all <base> <branch>\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"}]}