How do I keep copies of files in a Git repository?

Asked

Viewed 44 times

0

I maintain this repository https://github.com/silash35/qpdftools-packages that contains binary files from another repository. It was created to maintain the files needed to build packages. Currently it only contains package build files. deb, but in the future I intend to add support for Pacman (Arch Linux), Snap and maybe a . exe from Windows.

The problem is that each folder contains a copy of the executable (Binary). For now this is no problem, because if there is a modification in the binary (a new update for example) I can manually change each copy. But in the future, when the repository supports several different package managers, it will be difficult to maintain so many copies.

Is there any way to get the files automatically synchronized? Or make git understand that they’re the same file and you don’t need to store different histories for them? Or some other solution, which does not interfere when doing dpkg-buildpackage or similar no errors occur.

1 answer

-1

Hello Silash35 all right?

You can add the . gitignore file to the root of your project and insert into it the types of files that git should ignore. For example if you have a .exe that does not want to be in the repository add *.exe in your gitignore.

Example of a file . gitignore:

#ignora tudo que não terminar com .txt (em todas as pastas)
!*.txt 

#ignora tudo que termina com .exe
*.exe

After creating your . gitignore file you will need to remove these files from the git cache, so run the following command:

  • Remove the cache files git rm -r --cached .

  • Make a new commit and note that files will be deleted from the tree git commit -am "Meu Commit"

Documentation: https://git-scm.com/docs/gitignore

  • Thanks for trying to help. My goal is not to remove all binaries, but to keep multiple copies of it in the repository synchronized with each other.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.