简体   繁体   中英

push branch tarball to github with git

I have a git branch with let us say 2 directories, with some code files in it:

  • htmlcode
  • jscode

and I've made a tarball of this 2 directories in the same branch with Git. But to create a tarball with Git you need to do "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. I know why this happens, but don't know how to make a work arround to push only the tarball to 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?

Just use the tar/gzip commands themselves:

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 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. You really, really want to include the original source files in Git, and exclude the tarball. By only including the tarball, you're actually just hindering Git's built-in compression and rendering your repo more or less useless.

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