简体   繁体   English

用git将分支tarball推送到github

[英]push branch tarball to github with git

I have a git branch with let us say 2 directories, with some code files in it: 我有一个git分支,让我们说2个目录,里面有一些代码文件:

  • htmlcode htmlcode
  • jscode jscode

and I've made a tarball of this 2 directories in the same branch with Git. 我用Git在同一个分支中制作了这两个目录的tarball。 But to create a tarball with Git you need to do "git add htmlcode jscode" 但要使用Git创建tarball,你需要做“git add htmlcode jscode”

The problem I now have is that it pushes all the files in my branch (ie htmlcode, jscode and the tarball) to Github. 我现在的问题是它将我的分支中的所有文件(即htmlcode,jscode和tarball)推送到Github。 I know why this happens, but don't know how to make a work arround to push only the tarball to Github. 我知道为什么会发生这种情况,但是不知道如何将一个工作放在一边只将tarball推送给Github。

Can anybody help me? 有谁能够帮助我?

No part of this makes sense. 这一点没有任何意义。 Why are you using Git to generate the tarball, if you don't want to include the original files in Git? 如果你不想在Git中包含原始文件,为什么使用Git生成tarball?

Just use the tar/gzip commands themselves: 只需使用tar / gzip命令:

tar czf my-code.tar.gz htmlcode jscode

And then (if you really do want to do this) add the resulting file to Git: 然后(如果你真的想这样做)将结果文件添加到Git:

git add my-code.tar.gz
git commit -m "Version-controlling a tarball for some unknown reason"
git push

That said, there's no reason to just be version-controlling the tarball. 也就是说, 没有理由只对版本控制tarball。 You really, really want to include the original source files in Git, and exclude the tarball. 你真的, 真的想在Git中包含原始源文件,并排除 tarball。 By only including the tarball, you're actually just hindering Git's built-in compression and rendering your repo more or less useless. 通过仅包含tarball,你实际上只是阻碍了Git的内置压缩并使你的repo或多或少无用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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