How do I push files specified in .gitignore?

眉间皱痕 提交于 2019-12-18 16:58:46

问题


If I have a "vendors" directory in my .gitignore, is there a way I can set up a remote that will receive that directory anyway when I do a push?


回答1:


I think the functionality you're looking for can be achieved by having a branch used to deploy to your Cloud Provider.

Setup a dev branch which includes your .gitignore file, check your incremental work into that branch.

Merge your dev branch into your deploy branch which doesn't contain a .gitignore file but contains the vendors directory.

once you've completed your merge, push to the deployment remote from your deploy branch.




回答2:


Your .gitignore file has nothing to do with pushing. It is used by things like git status and git add to figure out what files should be (or could be) part of a future commit. You can add things that are ignored using the git add command; it will throw an error unless you use the -f option:

The following paths are ignored by one of your .gitignore files:
somefilename
Use -f if you really want to add them.
fatal: no files added

Once you've added the file to the repository, it will be pushed along with any other changes.



来源:https://stackoverflow.com/questions/11788229/how-do-i-push-files-specified-in-gitignore

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