Find the commit sha of a file with git

南楼画角 提交于 2021-02-10 05:49:49

问题


I have a folder with an unknown version of a project versioned with git. The project in the folder (not versioned) have some minor changes that i would introduce in the main versioned project.

I know that the folder project started from a commit a point in the time that is in my versioned project.

I want to find the original starting commit, create a branch, apply the minor changes and then push up everything up to the master.

How can i do this? I can assume that some files has not changed so, is possible to find a version (commit sha) of a file?


回答1:


git log --name-only will list the files associated with each commit sha.

If you have a particular file in mind you can use git log \-- filename

e.g. git log \-- main.c

This will show only commits which affect main.c



来源:https://stackoverflow.com/questions/41147490/find-the-commit-sha-of-a-file-with-git

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!