DitJid
DitJid

Reputation: 13

push branch tarball to github with git

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

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 (i.e. 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?

Upvotes: 1

Views: 2794

Answers (1)

user229044
user229044

Reputation: 239291

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.

Upvotes: 3

Related Questions