How do I simply branch/copy master and upload this branch to GitHub?

I must be missing something really obvious, but I’m struggling to do this.

I want to copy the ‘master’ repo on my local computer and create my own branch ‘copy-of-master’ and then upload that to GitHub (with no changes).

  • What's the simplest way to edit conflicted files in one go when using git and an editor like Vim or textmate?
  • Add items to git index efficiently
  • Pushing from local master to a remote non-master branch
  • Using GitHub for mac with an old Xcode project
  • How do I maintain multiple iOS apps out of a single repository?
  • How to pull specific remote into current branch in VS Code
  • I want to be able to see on GitHub this new ‘copy-of-master’ branch that will be the same as the master, nobody else will use so I can just upload changes without touching master.

    Somebody else will take care of later merging this into ‘master’.

    To add confusion I have used a combination of PhpStorm and Git on the command line.

    Here’s what I have done, and why I can’t understand what PhpStorm is doing:

    1. git checkout master
    2. Added new branch in PhpStorm (from master I’m guessing). It did show my current branch as master in the bottom right corner.
    3. ‘git status’ now shows I’m in my ‘copy-of-master’ branch.

    Now, surely I just ‘push’ to the repo and there should be my branch.

    The problem is I’ve tried this in PhpStorm and it comes up with this:

    no tracked branch. Use checkbox below to push branch to manually specify, showing 5 recent commits

    It then shows 5 random commits that have been done over a variety of times.

    Also, at the bottom it shows an option “Push current branch to alternative branch” but the alternative branch is the branch I’m already on anyway (??).

    I’ve used PhpStorm Push before and it always ended up automatically merging my work into the main branch. I don’t want to mess anything up this time.

    Nobody else is working on the repo at all.

  • Seeing all my git commits for the day
  • Conceptual difference between git fetch and git merge? Why do they feel same to me?
  • What exactly does git rebase --skip do?
  • How does Capistrano work by default?
  • Gitkraken Desktop App - Error login: “Please log in to continue”
  • Git mark file as binary to avoid line separator conversion
  • One Solution collect form web for “How do I simply branch/copy master and upload this branch to GitHub?”

    I’ve never used PhpStorm before, but assuming that it can detect git changes that you make from the command line (like creating new local and remote branches), then you can do all of the things you want to do exclusively using git from the command line:

    git checkout -b copy-of-master
    git push -u origin HEAD
    

    This will create a local branch copy-of-master based off of master, and set it to automatically track its remote version origin/copy-of-master.

    Documentation

    • checkout -b: “Specifying -b causes a new branch to be created as if
      git-branch(1) were called and then checked out.”

    • push [-u|--set-upstream]: “For every branch that is up to date or successfully
      pushed, add upstream (tracking) reference, used by argument-less git-pull(1)
      and other commands. For more information, see branch.<name>.merge in
      git-config(1).”

    Git Baby is a git and github fan, let's start git clone.