-2

If I have some project in my virtualbox's ubuntu, what is right way to upload to github?

Of course I need frequent source revision, so after edit, I should compile(qmake, make) or not?

Just source revise and then upload it is enough?

Then revision at github directly is enough?

Those guides does not says about local repository's source's compiling.

Someone said that I should not compile source before push to git.

For push to git, he said I should do with sources [BEFORE] compiling.

What is the reason?

I saw lots of guide, but

Those guides does not says about local repository's source's compiling.

creator
  • 671
  • 11
  • 28
  • [Hello GitHub](https://guides.github.com/activities/hello-world/) – Ron van der Heijden Mar 16 '18 at 10:17
  • 2
    You should only push source files to github. – Jim Wright Mar 16 '18 at 10:22
  • What if I already compile source? Then I can't upload to git? – creator Mar 16 '18 at 11:42
  • 1
    Possible duplicate of [Git for beginners: The definitive practical guide](https://stackoverflow.com/questions/315911/git-for-beginners-the-definitive-practical-guide) – phd Mar 16 '18 at 12:13
  • Those guides does not says about local repository's source's compiling. Someone said that I should not compile source before push to git. For push to git, he said I should do with sources [BEFORE] compiling. What is the reason? and if I already compiled, then how to push? – creator Mar 16 '18 at 13:10

2 Answers2

1

As a general practice you want your git repository to have your sources, and any scripts needed to compile and configure your project. This way someone else on your team can pull the repository and be able to compile and run the project on their own machine. You might also want an official build machine that does this.

You also want to compile and test your changes before you commit and push to github, since you want to confirm that your changes work.

Once you compile the code yourself, you will now have various binaries locally that you don't want to upload (For example if your project is Java, you don't want to include the jars in your repository). You can use a .gitignore file to exclude those from being uploaded to github. There are examples for many different projects here: https://github.com/github/gitignore

If you don't have a .gitignore file, then all of your local changes will be included when you commit and push to github.

So if you have all of your source files, project files, build scripts, and a .gitignore appropriate for your project, then you can commit and push before and after compiling.

Chris Riccio
  • 573
  • 3
  • 11
  • Thanks! But why I don't want to upload jars in my repository? Actually, my current project is alt-coin cloned litecoin. And now if I have only one local repository and there already I compiled, then what should I do? – creator Mar 16 '18 at 14:57
  • 1
    One reason that you don't want your compiled results in the repository is that they are essentially a duplicate of what is already there. Sources + Build Script = Compiled Results. So upload and download will take longer if they are included. – Chris Riccio Mar 16 '18 at 17:34
  • Aha, so capacity, file size! So, what should I do now then? I already compiled. Then I revise or add meaningless line to one source file, and then upload this? Then how can I exclude Build script and only upload sources? – creator Mar 17 '18 at 03:37
  • If you are using the git commands (add, commit, push, pull) then git takes care of only sending what you changed up to github. – Chris Riccio Mar 18 '18 at 04:36
0

Here is a description how to upload to github:

https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/

The other questions you need to answer for yourself.

YesThatIsMyName
  • 1,585
  • 3
  • 23
  • 30
  • Those guides does not says about local repository's source's compiling. Someone said that I should not compile source before push to git. For push to git, he said I should do with sources [BEFORE] compiling. What is the reason? – creator Mar 16 '18 at 13:08
  • @leegod Also if you have compiled files, they may not work on all systems. Usually there are configuration files to build the executables one needs. Maybe there are missing libraries, tools, etc. Every computer system is different. If you compile it to work on yours, it is never guaranteed to work on an other system. If you just use (g)it for yourself ... in my opinion ... it is ok to push the executables, especially if compilation takes long. That is why i said in my answer, you have to decide by yourself, because only you know what you need. – YesThatIsMyName Mar 19 '18 at 07:42
  • Thx for reply. So then I should always take 2 project copies? One for upload to git without compiled, one for test and develop with compile? – creator Mar 19 '18 at 15:16
  • And now if I have only 1 project folder, already compiled, then how can I upload uncompiled slim size project? – creator Mar 19 '18 at 15:17
  • @leegod One way is to clean your project before uploading ... e.g. with Makefiles (make clean), or you upload the source files one by one to git, or you use gitignore files as already described in an answer. – YesThatIsMyName Mar 20 '18 at 14:03