Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Is there such a thing as too man git commits? Reply To: Is there such a thing as too man git commits?

#158380
__
Participant

Making a branch is like …a branch

Normally, when you commit, your project history keeps going in a straight line:

init ----- commit1 ----- commit2 ----- commit3 ...

Making a new branch is a lot like forking, except you stay on the same repo instead of creating a new one:

commit3 -
         \
          branchA ----- commitA1 ...

If you switch back to the master branch, everything is still like you left it (in this case, commit3). You can even keep working on master (or create/work on other branches):

commit3 ----- commit4 ...
         \
          branchA ----- commitA1 ...

When you’re done working on whatever you branched for, you can merge it back in. If master has changed in the meantime, you might have to fix things if there are conflicts. If it’s only you, however, you can keep branches task-specific (i.e., don’t work on the same features/files on different branches) and it won’t be an issue.

I think this is the git talk I’m thinking of. It’s broad, and long, but it explains things nicely. (About 45min in he talks about branching, but I’d recommend watching the whole thing.) I’ll post if I find another one.