Currently I have the following branch
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
What I want to do is
- Move my master branch into branch feature-1
- Copy a new master branch from existing master, and make change
So at the end, both my local and remote will have 2 branches – master & feature-1, and when I push from the local master branch, remote master branch will be updated. While when I do push in feature-1 branch, the remote feature-1 will also be updated.
You don’t need to “copy” your current
masterbranch, you simply create afeature-1branch on top of the current master and push it to origin.Note the
-uoption for the first push of feature-1 branch. You won’t need agit set-upstreamto link your local branch to a remote branch of the same name on origin.See “Git: Why do I need to do
--set-upstreamall the time?” for more.