Question

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).

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top