Thread (1 message) 1 message, 1 author, 2016-06-15

Re: Checkout first version of each file?

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:52:27

Dario Rodriguez [off-list ref] writes:
So, how can I checkout the first version of each file? (I know that
GIT tracks contents and not files, but the fact is that I need to keep
track on files, it's the real thing I work with)
In general "the first version of a file" is an undefined concept if your
history has merges of parallel development, but in a narrow special case
of linear history, you should be able to do something like this:

    $ git log --format='# %h %s' --diff-filter=A --raw --abbrev=40

which would give you something like

    # 8d19b44 Git 1.7.7.2

    :000000 100644 0000000... e6bbef2... A  Documentation/RelNotes/1.7.7.2.txt
    # 0f77dea mingw: move poll out of sys-folder

    :000000 100644 0000000... 708a6c9... A  compat/win32/poll.c
    :000000 100644 0000000... b7aa59d... A  compat/win32/poll.h
    # 8f41c07 read-cache.c: fix index memory allocation

    :000000 100755 0000000... bca359d... A  t/t7511-status-index.sh
    ...

so that you know what blobs to check out to which path. E.g.

    $ mkdir -p compat/win32; git cat-file blob 708a6c9... >compat/win32/poll.c
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help