简体   繁体   中英

Git: can I get git to store contents of a link create with ln?

Let's consider we have a file f somewhere on the disk: /path/to/f

Since f is not inside my git repository (and has to remain at it's original position) I would like to create a link in my git repository, so that I do not have to manually copy changes of f every time into the git repository.

In other words: I would like git to track the contents of f , although f is not located in the repository.

How can I achieve this behavior? Is it possible to force git tracking the contents of links created with ln ?

If you do ln /path/to/f /path/to/your/repo/f , the contents are stored fine in the repository, as you create a hard linke, meaning a second name for the same file on disk. If you change one, you change both, but for programes the files appear to be separate files but they are essentially only two pointers to the same file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM