Pushing untracked content with git

江枫思渺然 提交于 2019-12-11 16:54:34

问题


I have a project in git with a bunch of graphics (.jpg, .png, .tiff, etc). The graphics extensions are in my .gitignore (this can change) because I do not need to version the graphics (the department responsible for graphics has version cue and tracks their own changes to the graphics). However, when I push, it seems only the tracked content gets to the repository. I need the graphics to be pushed with the repository, but I do not want to track the graphics files, how would I do this (or is it even possible)?


回答1:


You can add files to repository even if they are ignored (match pattern in .gitignore).

You can push with git only what is comitted, so you can't push (using git) untracked files. You can use other mechanizm like rsync or scp instead (if it is on other server).




回答2:


Tracked files are files that should go in the repository, so if you want the graphics in the repository, you want them tracked.

Also--while the department doing the graphics may track their changes to the files, you'll want to track the graphics file that you're using with the project, which is different. Tracking those for your project with git accomplishes that.




回答3:


You can't push unless it's tracked.

Are you using the push as a deployment step? If so you either want to track the graphics files in order to push them. Or you want a seperate deployment step for the graphics files. Personally I'd just add the graphics files to the repo. Disk space is cheap.




回答4:


Depending on your project, if you have a large number of those graphics, you may want to keep all those images in a database table. That's what BLOBs are for.



来源:https://stackoverflow.com/questions/1395729/pushing-untracked-content-with-git

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!