git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Getting a branch's time of creation
@ 2010-03-17 14:45 jateeq
  2010-03-17 16:32 ` Randal L. Schwartz
  2010-03-19 20:54 ` Jakub Narebski
  0 siblings, 2 replies; 4+ messages in thread
From: jateeq @ 2010-03-17 14:45 UTC (permalink / raw
  To: git


Hello,

I am trying to find the time at which a remote branch was created, so that I
can use the '--since' option in git log to limit the commits to only ones
that were created for that branch (read below to see why I can't use 'git
log <branchnname>). So my question: does git remember the time at which a
branch was created, and how can it be listed?

NOTE: Once I clone a repository that contains Branch1 (which will have its
own commits as well as commits from the master branch), I create Branch2 in
the clone to track Branch1. Branch1 will have commits before the cloning,
and Branch2 will have its own commits after the cloning, but I want to list
both. The way I am thinking of doing it is to list all commits for Branch2,
and then limit the commits to only ones that were created after Branch1 was
created.

If anyone has suggestions on doing this alternatively, feel free to pitch
in. Thank you.
Jawad.

-- 
View this message in context: http://old.nabble.com/Getting-a-branch%27s-time-of-creation-tp27933166p27933166.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Getting a branch's time of creation
  2010-03-17 14:45 Getting a branch's time of creation jateeq
@ 2010-03-17 16:32 ` Randal L. Schwartz
  2010-03-17 17:24   ` jateeq
  2010-03-19 20:54 ` Jakub Narebski
  1 sibling, 1 reply; 4+ messages in thread
From: Randal L. Schwartz @ 2010-03-17 16:32 UTC (permalink / raw
  To: jateeq; +Cc: git

>>>>> "jateeq" == jateeq  <jawad_atiq@hotmail.com> writes:

jateeq> I am trying to find the time at which a remote branch was created, so
jateeq> that I can use the '--since' option in git log to limit the commits to
jateeq> only ones that were created for that branch (read below to see why I
jateeq> can't use 'git log <branchnname>). So my question: does git remember
jateeq> the time at which a branch was created, and how can it be listed?

You're probably looking for the commit at the common ancestor
of a given branch (which is a point, not a line, remember) and a branch
you're interested in, like maybe "master".

consider something like:

git log $(git merge-base origin/somebranch origin/master)..origin/master

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Getting a branch's time of creation
  2010-03-17 16:32 ` Randal L. Schwartz
@ 2010-03-17 17:24   ` jateeq
  0 siblings, 0 replies; 4+ messages in thread
From: jateeq @ 2010-03-17 17:24 UTC (permalink / raw
  To: git


Great, that works -  it gives me the commit that Branch 1 was at at the time
of cloning.

One concern however. If I clone the repository, create Branch 2 to track
Branch 1, and in the mean while push changes to the master branch of the
repository, the commit that this command gives me changes (to the last
commit that was pushed). The repository I am cloning from is bare, so in
order to make changes to the master, I clone it again, make changes to the
master branch of the clone and push those back (of course, this clone also
has Branch 1 as a remote branch, but I am not making changes to it). What is
git doing? Why does it change the commit history of Branch 1 when I did not
push changes to it? 

Before pushing to master:
$git log --oneline $(git merge-base origin/jateeq.2010-03-16.15-32
origin/master)..origin/master
610cfae added file.xml

After pushing to master:
$git log --oneline $(git merge-base origin/jateeq.2010-03-16.15-32
origin/master)..origin/master
9070a4d removed fcc.xml


Thanks, 
Jawad
-- 
View this message in context: http://n2.nabble.com/Getting-a-branch-s-time-of-creation-tp4750687p4751743.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Getting a branch's time of creation
  2010-03-17 14:45 Getting a branch's time of creation jateeq
  2010-03-17 16:32 ` Randal L. Schwartz
@ 2010-03-19 20:54 ` Jakub Narebski
  1 sibling, 0 replies; 4+ messages in thread
From: Jakub Narebski @ 2010-03-19 20:54 UTC (permalink / raw
  To: jateeq; +Cc: git

jateeq <jawad_atiq@hotmail.com> writes:

> I am trying to find the time at which a remote branch was created, so that I
> can use the '--since' option in git log to limit the commits to only ones
> that were created for that branch (read below to see why I can't use 'git
> log <branchnname>). So my question: does git remember the time at which a
> branch was created, and how can it be listed?
[...]

> If anyone has suggestions on doing this alternatively, feel free to pitch
> in. Thank you.

It looks like an XY problem to me: you are asking how to get about
specific solution, instead of about how to solve a problem.

If you know what branch was remote branch created from, you can simply
use

  $ git log <base>..<branch>

which translates into

  $ git log <branch> ^<base>

which means everything in <branch> that is not present in <base>.
(Assuming that <branch> is the branch you are interested in, and
<base> is the branch it was branched off).

<base> might be result of "git config --get branch.<branch>.merge"
(if the upstream was correctly configured).

You can also get branching point with

  $ git merge-base --all <base> <branch>

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-03-19 20:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-17 14:45 Getting a branch's time of creation jateeq
2010-03-17 16:32 ` Randal L. Schwartz
2010-03-17 17:24   ` jateeq
2010-03-19 20:54 ` Jakub Narebski

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).