Is it bad to "stage all"?

For the most part, the project files we’ve done have all been pretty small in size up until the Argon assault one (which is at a whopping 1GB+ with all the asset packs we’ve imported.

Does this mean, every time I push a commit, it will take up the 1GB+ and the changes (like an initial 1GB+ for the initial commit)? Also, when a project is finished, is there a way to remove any previous commits?

I only ask because I don’t have a small or large (just average) sized hard drive, but I could never figure out how much space it was eating into. And that there seems to be no way for me to delete commits in case they are eating into precious drive space. Or to remove commits that were just simply all the way at the beginning that I don’t need anymore.

I might just not be fully understanding all of the version control other than it being for rolling back when needed. But what about when you’re at a point where you’ve got a very polished core, and would like that to be the new “baseline”.

Hi Magnus,

Fortunately not. Do you use Sourcetree? If so, you can see what exactly gets changed. When you edit your code or any Unity files, usually, only a bunch of lines of code/text get replaced, added or removed. However, be careful with pictures because they get included completely. If you change and commit a 1 MB picture 100 times, you will have added 100 MB to your repo.

Also, when a project is finished, is there a way to remove any previous commits?

Yes, there is, but it is advisable not to remove any commits unless you really, really must, which is very unlikely, and know what you are doing. You can easily destroy your entire history. Deleting commits in the git history is like using the materials of a building foundation for the roof. It could work but if you make a mistake, the whole repo is ruined. This cannot be undone. Depending on what you do, it could even affect/destroy your actual project.

Version controlling is about keeping a history of all project states. The longer you work on a project, and the larger your project is, the larger your git repo will become. That’s normal.

The best advice is: Don’t mistake git for Jenga. Don’t touch the commits.

But what about when you’re at a point where you’ve got a very polished core, and would like that to be the new “baseline”.

What do you mean by that?

Branching is how you resolve your experiments/progress from your baseline.

So the baseline is really just your master (or main) branch, most of your iterative work is done on a separate development branch, until you’re ready to say ok we’re good to go for a new gold/master build, and then you merge the changes into master.

That will still bring forward everything that was in the development branch, but the points at which you touch master (and can view the differences between one commit on master and the next) are a lot more compact and cleaner.

Furthermore you will probably want to experiment new ideas, some “what if” scenarios, and the like. These you can create as additional branches off of development, that once you’re done with them, can choose whether to keep them (merge to development) or discard (leave as a hanging branch for reference or just delete it if not needed).

A properly set .gitignore for Unity and your IDE combined will prevent you from adding too much unnecessary clutter in your repository that those tools create, but aren’t needed in order to recreate your project.

I don’t know if you’ve taken (or are taking) the GDTV Sourcetree/Git course but it sounds like it would be pretty beneficial for you, given where you are in your usage with it.

Yeah I’ve been using Sourcetree for all of the projects up until Argon Assault. I’ve been keeping the .gitignore in-line with the recommended .gitignore file setups for Unity.

This was moreso, on what if I am finished or want to throw away a project. How do I get rid of that space it is taking up on my hard drive? (see not small, not large hard drive space).

If you want to get rid of the git repo, just delete the .git folder inside your project folder.

Alternatively, you could save your entire project folder including the .git folder on an external harddrive (as a backup so to say) and delete your project folder on your internal harddrive if you need that space.

Thank you for that! I ended up moving the repos all to an external instead :slight_smile:

You’re welcome.


See also:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms