0

I am experimenting with using git along with Git LFS to version control my filmmaking workflow.

I have two questions:

1) Is there a way I can track all versions of a file? git log <path/to/file> gives me all the commits that involved that file, and that is great, but I would also love to find a way that lists only the blobs that refer to the file. They are all in .git/objects as git rev-list --objects --all shows, but I want to limit the results to showing only the blobs that relate to the file I want.

2) Using the data generated by rev-list, is there a way for me to sort of generate a human readable version number for the files, maybe something that uses the name of the file and the date it was committed to maybe add a note or a tag that looks like "filename_v001" or "filename_commitDate", as this would be more readable than the SHA?

All I want to achieve with that is something that works like tags do on a commit, but for a file.

I am really not sure if these things can be done or not as I am totally new to git and still trying to figure it out and see if it fits my needs.

  • If you are using Git LFS, the blobs are only going to refer to the text pointers rather than the files themselves. Is that what you want? Seems like you could get something simple with e.g. `git log --format=%at-%t` – cmbuckley Jul 27 '17 at 15:46
  • Tags can tag any object (not just commits); so if you want something like tags but for files, you might see if tags will do – Mark Adelsberger Jul 27 '17 at 16:47
  • @cmbuckley I understand that Git LFS blobs are just text pointers, and I am okay with that. `git log --format` is an interesting choice, but the problem I have with it is that it still works on the commit level, not the file level. Also, there doesn't seem to be a way to make it include the name of the file, to make pseudo file names that are more readable for someone who is not tech savvy. – Abdelrahman Said Jul 27 '17 at 21:18
  • @MarkAdelsberger I know tags can be used on any object, but from what I've read and understand, it is not recommended to use it with anything other than the commits, as they basically lose their value, which is to automatically increment the version number, submitted in the tag, every time you submit a new commit. I might be wrong though, and there is a way to make use of tags with files, but I couldn't find anything. – Abdelrahman Said Jul 27 '17 at 21:22
  • @AbdelrahmanSaid the commits still refer to unique identifiers corresponding to each version of the file; even if those commits change other files then the only way a file can change is if there is a commit relating to it. Remember that [git tracks content rather than files](https://stackoverflow.com/questions/5604232/can-someone-explain-the-distinction-between-content-tracking-used-in-git-and-fil), so it's a lot easier to use the commits. Perhaps you can use git log to construct the filename, e.g. `git log --format=%at-%t-$filename $filename`? – cmbuckley Jul 28 '17 at 08:34
  • @cmbuckley you know what, I think that might be a really good idea.. I will have to try it, but I think it should work – Abdelrahman Said Jul 28 '17 at 15:24
  • @cmbuckley I think it is gonna work.. I have did a quick test using Python (which I intend to use anyway) and got it to use the filename and the commit date to convert them into version numbers, giving me `test_v004.txt, test_v003.txt, test_v002.txt, test_v001.txt`.. I will keep playing around with it to make sure it works well. Thank you very much for your help. – Abdelrahman Said Jul 28 '17 at 16:36

0 Answers0