Git repositories aren't technically centralized anywhere but you could refer to one as the “source of truth.” Typically this called “origin” but development teams who are working on a giant feature together could define their own GIT remote for other teammates before pushing to origin.
Typically when you're coding, you're either building a new feature or fixing a bug. When both need to happen at once, that's when things get interesting.
Typically you'll have two main immortal branches. These are the branches changes are pushed to (git push):
Once source code in the development branch is stable, it is merged into master and tagged with a release number to represent a new production release.
It's good practice to pull with: git pull –rebase to avoid useless merge commits. You could modify .gitconfig to have this done automatically.
It's also good practice to initiate a pull request before merging into development/master.
I recommend using this extension to make your life easier: https://github.com/petervanderdoes/gitflow
These branches are typically broken into the following:
Flow
Create
Merge
These branches are created once the development branch has all the required feature for the expected release. Release branches are great because it allows one team to polish up the release before it gets merged into the master while other teams could work on new features of a future release. It also allows an easy view of the preparation of the release. Once the branch is created, no additional features are allowed. These are allowed:
It also helps Primarily prepares code for production release. Allows for last minute changes, minor bug fixes, and prepping version number, build dates, etc for release. The perfect time to branch off from development into a release branch is when all features targeted for the next release is merged into the development branch. Only when the release branch is created is a version number for the release is assigned.
Flow
Create
Merge
Tagger: John Doe <john@doe.com> Date: Fri Aug 14 04:39:17 2015 +0000 First release with ICD-10 Support commit 1590c3a6b71232146192c8ab6dc3db5d79d8Merge: 6723e49 e4870c2 Author: John Doe <john@doe.com> Date: Fri Aug 14 04:28:10 2015 +0000 Merge branch 'icd10-prep' into develop
These are the only branches that could branch from master. When there's an emergency fix that needs to take place, you need to branch off of the current production tag that's on the master branch. This way developers could continue to work on the development branch while others could work on a critical bug fix without affecting them (development could be unstable at the time the fix is needed). In a way this is very similar to the Release branches.
Flow
Create (Assuming fix is on version 1.3)
Merge