threads / discuss / 42690

Problem Following file history through sub-tree import

Subject: Problem Following file history through sub-tree import

## tl;dr

One message between Jun 22, 2016 and Jun 22, 2016.

replies: 0people: 1as markdown or json

Crabtree, Andrew· Jun 22, 2016, 16:43 UTC · lore

Having difficulty understanding how to invoke 'git log' to track the history of a file that was imported into a different location through a subtree merge. I had thought just '--follow' was needed, but I don't seem to be getting any results with that.

Example below.

Thanks! ~Andrew

git --version
   git version 2.9.0
cd /tmp
mkdir subtree_test
cd subtree_test
git init 
touch foo
git add foo
git commit -m "initial"
git remote add git_src https://github.com/git/git
git fetch git_src
git merge --allow-unrelated-histories -s ours --no-commit git_src/master 
git read-tree --prefix=git_src -u git_src/master
git commit -m "import git as subtree"
cd git_src
git log pager.c
commit 22e7b2600b54f25314c399d45b1ea45d2427c754
Merge: 8df5087 ab7797d
Author: Andrew Crabtree <andrew.crabtree@hpe.com>
Date:   Wed Jun 22 08:58:04 2016 -0700
    import git as subtree
git log --follow pager.c
# nothing 

gitk pager.c * # only shows merge commit 22e7b

git gui blame pager.c & # shows history as expected

git log HEAD^2 -- pager.c 
commit c3b1e8d85133e2a19d372b7c166d5b49fcbbfef2
Merge: 595bfef 708b8cc
Author: Junio C Hamano <gitster@pobox.com>
Date:   Wed Feb 24 13:26:01 2016 -0800
    Merge branch 'jc/am-i-v-fix'
    
    The "v(iew)" subcommand of the interactive "git am -i" command was
    broken in 2.6.0 timeframe when the command was rewritten in C.
    
    * jc/am-i-v-fix:
      am -i: fix "v"iew
      pager: factor out a helper to prepare a child process to run the pager
      pager: lose a separate argv[]
commit 3e3a4a41b0dac564c0302ced4ccc423d0d39bc21
Author: Junio C Hamano <gitster@pobox.com>
Date:   Tue Feb 16 14:34:44 2016 -0800

← back to recent threads