My Situation is this: I work on a modification for an old game with source code. There are a lot of files. Since it is an old game, all files that haven't been changed by me have an old file change timestamp.
It would be really helpful for me if I could only add the files to the repository (track them), that have been changed recently (by me). That way it would be really easy to see at once which files have been changed and it would make it easier to automatically package them.
I could write a program which tracks the timestamps of all files in the background and changes dynamically the gitignore file. But is it possible to do such things with git onboard tools?
Greetings,
Neconspictor
I do not know of a git tool to do this. The obvious location would be in the gitignore
tool, but it only works with file patterns. You will have to generate this file list independently. Since your files are just local, the file list do not need to be pushed to the git server, so $GIT_DIR/info/exclude
sounds like the right location to put the list.
In your case, you can generate the list with something like (e.g. for 2015-03-22 at 15:30):
touch -t 201503221530 timestamp_file
find . ! -newer timestamp_file > .git/info/exclude
However, if not too troublesome I would generally advise to track everything in git:
git diff --name-only <sha1> <sha2>
or git diff --name-only <sha1> HEAD
)pre-commit
hook, to check that all files in .git/info/exclude
are older than timestamp_file
, and refuse the commit if that is not the case.)git diff --name-only <sha1> HEAD
anymore, because it will include adding C before your changes. So it is in no way "easier to automatically package them", it is indeed much harder.