When do you commit changes to git?

Do you make commits change by change or do you wait until the end of the day and go through your changes?

I commit a lot. I generally make a commit anytime I write something and it functions at least basically as expected, or even if I just get something stubbed out.

I look at it as a save game for engineering. Save the game before you kick the door down on the new room full of monsters. Open the chest and get five million gold? Hit the save game.

Also, commit only related stuff, don’t commit everything that was touched. Sometimes you throw in debugging code while you’re working, and generally you do not want that committed, unless its guarded by conditional compiles.Get a git client that lets you stage only certain files and get used to that working pattern: it will save you making unnecessary changes.

If I make a central function that I need (such as in some game-wide manager), and then I use it somewhere else, I generally commit the actual function first, as a separate commit with all the commentary, and then I commit the usage of it second, in a separate commit.

Also, use comments… explain what you just got working at a minimum… you’ll thank yourself later.

Finally, it’s best to CLOSE Unity before committing, especially if you change anything non-script (prefabs, materials, scenes or other assets) because Unity is really lax and lazy about calling fflush() and committing changes to disk, which can be maddening. Mostly you can achieve the same effect by doing a Save-Scene, because that does an implicit Save-Project, which is what you need to commit everything to disk so git can commit it.

1 Like

It is like saving your progress playing a game. Whenever you reach a stopping point, commit. Whenever you are about to open some new door into the unknown, commit. Whenever you have made significant progress you don’t want to lose, commit. Whenever you are about to try something you are not sure about, commit right before. Whenever you are done for the day, commit. Whenever you finish something and are moving on to something new, commit.

I have zero idea on how to use git or any other version control.

I want to learn how, but I got other shit to do right now so it’s pretty much control+z for me :smile: (and a few back up copies every now and then, luck terabytes are a trivial thing now.)

am I the only one…? :sweat_smile:

1 Like

That works fine for small solo projects, and will save your rear from most of the trouble you’ll run into. A weakness where version control comes in is with viewing change history or reverting changes to a single file. Also if you work on a desktop and a laptop it is a pain to move your project folder back and forth especially after it gets pretty large.

2 Likes

Yeah, I work purely on my desktop at home, I can’t stand laptops for work, they’re fine for browsing the internet and writing down ideas, but that’s as far as they go for me.

Also I’m not in any hurry, I’m still giggling at the speed we run at today every time I boot my (now old)new rig, ssd and all that jazz, my little brother got one of those M2 things that goes in the pci last month and it’s just ridiculous.
I remember when I wanted to transfer 300 megs and it was an over nighter.(not implying that i’m old, at all) (;

you know that louie ck bit about the cell phones? “It’s going to space! give it a second!”

2 Likes

Ideally I’d like to commit on every small change that functions as intended, but I have a bad habit of changing/adding a ton of things that may or may not relate to each other and having to type something generic like “Fixed broken features” as the commit message.

1 Like