Branch a master repo and merge local copy

How does one merge a local master branch that has diverged from the master on the server with a new branch created from the current master branch on the repo?

I have been working on a local copy of a master branch and the status of the master branch is different to when I started working on the local copy. How do I merge my local copy into a fresh branch I want to create from the master branch?

  • Incorporate HTML5-boilerplate as a Git submodule or is there a better option?
  • How to migrate from RTC Jazz to Git?
  • Generic git reset to default upstream HEAD
  • git cherry-pick multiple commits
  • How to remove unwanted commit and merge
  • git add on a file excluded by .gitignore
  • I want to do this to push my local changes to the server for safety.

  • Is there a way to get git to autocomplete commands based on a shortened version?
  • Revert a merge after being pushed
  • List all developers on project in git
  • How to merge a commit into an earlier commit?
  • Can't start Git Bash
  • How can I 'git clone' from another machine?
  • One Solution collect form web for “Branch a master repo and merge local copy”

    First, start by creating a new branch at your local master:

    git checkout master
    git branch my_feature_branch

    Then, just move your local master to the upstream master

    git branch -f master origin/master

    And, push your new branch up:

    git checkout my_feature_branch
    git push origin my_feature_branch
    Git Baby is a git and github fan, let's start git clone.