Using git branches

For CS course projects it is likely sufficient for you and your partner(s) to clone versions of a single master repository and then push and pull changes to it. For larger and longer existing projects, you may want to use git's support for creating separate branches of your repository. For example, different branches could be associated with different users or with different features, and users can push, pull, and merge changes from branch to branch.
# create a new branch named mybranch and push it to the master repo:
git checkout -b mybranch
git push -u origin:mybranch

# list the current branch of your copy of the repo:
git branch
git branch -avv #verbose listing of local and remote branches

# switch to different branch: git checkout branchname
git checkout master
git checkout mybranch


# to merge changes from mybranch into the master branch
git checkout master
git merge mybranch

# if merge conflicts
git add   any files that needed to be fixed up from the merge conflict
git commit

# if you want to push your new version of master that is merged
# with mybranch to the remote:
git push 
# if git push fails try 
git push origin master   

# if you want to undo a merge  
# (and best to undo before making local changes, commits, pushes, etc.)
git reset --merge ORIG_HEAD