Creating a Branch with Git

Pick a branch name:

export BRANCH="mybranchname"

Create the branch and switch working tree to it:

git branch $BRANCH
git checkout $BRANCH

Push the branch to a remote repository:

git push origin $BRANCH

Update config to sync branch to repository:

cp .git/config .git/config.save
cat >> .git/config <<EOF
[branch "$BRANCH"]
        remote = origin
        merge = refs/heads/$BRANCH
EOF

Merging the Branch Back Into the Master

Remember the branch name:

export BRANCH="mybranchname"

Switch your tree to the master:

git checkout master

Merge the branch code:

git merge $BRANCH

You may need to resolve conflicts here.