How maintain local branches like bitbucket remote branches and how to sync code changes?

How maintain local branches like bitbucket remote branches and how to sync local code changes?