Concatenate git diffs from all time -


i have file in repo has been moved , changed several times since created it, , i'm trying find original version. know was, grep location in contatenated list of git diffs since creation of repo.

note have removed file repo put in more appropriate one. guess can make harder... there easy way find commit file introduced though not exist more ?

you can capture full path of file in every commit, if know name, using ls-tree -r grep:

#!/bin/bash filename_to_look_for=specrunner.html commit_range=1cb1d..e172  echo looking file $filename_to_look_for in commit range $commit_range echo  list_of_commits=($(git rev-list $commit_range)) num_of_commits=${#list_of_commits[@]}  look_for_file_in_commit() { git ls-tree -r $1 | grep $filename_to_look_for; }  c in "${list_of_commits[@]}"   echo commit $c ":"   look_for_file_in_commit $c   echo done 

this example of output:

$ bash lstree.sh looking file specrunner.html in commit range 1cb1d..e172  commit e172774592f13c9fc1bdcd22099e1a104c5d1208 : 100644 blob 33ce97139315d7240ea3d09a5c62f5ea89887cd7    testplans/e2e/specrunner.html  commit 14310bc0cf69967d4781e0aec2fd2cca21d72ac6 : 100644 blob 33ce97139315d7240ea3d09a5c62f5ea89887cd7    testplans/e2e/specrunner.html  commit 20e22a4b88f36f1f9109680c0bed8b6b28941e9f : 100644 blob 33ce97139315d7240ea3d09a5c62f5ea89887cd7    testplans/e2e/specrunner.html  commit fb80ab129f10225117c7a8b25ab51d1e7842e752 : 100644 blob 33ce97139315d7240ea3d09a5c62f5ea89887cd7    testplans/e2e/specrunner.html  commit 8d67498dd04ddb1bd27fd110554021d2a7b7c7f1 : 100644 blob 33ce97139315d7240ea3d09a5c62f5ea89887cd7    testplans/e2e/specrunner.html 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -