user2333940
user2333940

Reputation: 123

Keeping untracked files in git repo

I have a question about some, probably very niche operation that may or may not be possible. I think the answer may be somewhere near, but perhaps due to my failure to formulate the question well, I am not finding it. So here it goes:

Imagine a simple git repo with a few commits that contain a bunch of files and pretty much nothing else. What I want to do is to add a binary file in such a way that when it is modified, git updates the file but does not keep any of its history. So each time the file is changed, Git updates the actual data, but otherwise assumes it is unchanged.

The goal is to keep always-up-to-date version of a relatively big binary files that are required for the project but don't track them. The operation should not involve rebase and must be supported by popular git hosts (such as github) Edit: also the goal is to be able to clone git repo, run compile script and get the results immediately. So "keep these files in dropbox" is not a solution.

Is this even possible? Where should I look, Git LFS maybe? Seem to be not quite what I want. Thanks for any input.

Upvotes: 1

Views: 2553

Answers (2)

Keelung
Keelung

Reputation: 387

I've the same requirement. Please let me describe it simplely:

  1. Users still can download the update ignored files, such as a base disk image rootfs.img, by git clone.
  2. But when users build their own images by using the original image rootfs.img as a base, and then update it of cause, git should ignore the changes of this rootfs.img

This feature is useful when want to maintain or use a sdk package of one embedded system.

Upvotes: -1

Marina Liu
Marina Liu

Reputation: 38136

No, it’s impossible. This is because git will track the changes if the file added in git, so when you made any changes, git will find it.

There are some solutions you can refer:

  • Ignore this file in .gitignore .

  • Convert the binary file as ordinary file if possible (docx to txt, xlsx to csv etc), and then version control it.

  • Commit changes normally, and clean the old version of the binary file for a period of time by git filter-branch.

Upvotes: 1

Related Questions