github - Can you determine the git version of a file copied from a repo? -


i inherited xcode project uses code cocoaasyncsocket project (available on github). files (asyncsocket.m/h) copied xcode project have no git history.

i need find version of files have. there way can compare files (assuming haven't been edited) repo's history see commit have?

first compute hash of file using git hash-object.
can use git ls-tree list hashes of each commit in question.

i use this:

file=asyncsocket.m hash=$(git hash-object $file) in $(git rev-list  head -- $file);    git ls-tree $i|grep -q $hash && echo $i done|xargs -l git log -1 --oneline --decorate 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -