Git log shows very little after performing read-tree merge

So, I merged another repository into a subdirectory of the current repository, like:

git remote add -f Bproject /path/to/B
git merge -s ours --no-commit Bproject/master
git read-tree --prefix=dir-B/ -u Bproject/master
git commit -m "Merge B project as our subdirectory"
However, there seem to be subtle issues. When i do
git log dir-B/

the result is just the message "Combine the B project as our subdirectory." How to get the log information I want, i.e. imported dir-B history?

+3
source share
2 answers

Performing the merge shows example.txtin BProject/masterboth renamed dir-B/example.txt. git logdoes not track the history of the file / directory after renaming, if the option is not used --follow:

--follow
Continue listing the history of a file beyond renames (works only for a single file).

, BProject/master, dir-B, . , SHA , BProject/master! , , .

, Bproject, :

git-filter-branch manpage

To move the whole tree into a subdirectory, or remove it from there:
git filter-branch --index-filter \
        'git ls-files -s | sed "s-\t\"*-&newsubdir/-" |
                GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
                        git update-index --index-info &&
         mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE"' HEAD

, , , .

+4

r3m0t, , git :

( git-sh git ")

co -b my-new-branch 
remote add -f origin-my-old-standalone-project ../my-old-standalone-project/
pull origin-my-old-standalone-project master
mkdir my-new-subdir
ci -am "merge 'old' standalone project as new branch 'my-new-branch'"
git filter-branch --index-filter \
        'git ls-files -s | sed "s%\t\"*%&my-new-subdir/%" |
                GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
                        git update-index --index-info &&
         mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE"' HEAD

: , , , . ( , - , "-" .) IDE (, PyCharm) .

, .

tl; dr: --follow , 6 git git/p >

0

All Articles