Rotate master branch into feature branch

Currently I have the following branch

* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master

What I want to do is

  • Jenkins - Can't push tag to remote repository
  • Git: Ignore files for public repository, but not for private
  • How can I delete a commit to git
  • Trac component(s) referencing separate GIT repositories
  • How to 'git pull' into a branch that is not the current one?
  • Git asks me to commit or stash changes on checkout master, even though all changes were committed?
    • 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.

  • Can't commit Xcode project with åäö in filename
  • git-svn and a remote git repo sync
  • How do I access my SSH public key?
  • git - removing rails development log
  • Running a Ruby on Rails app from GitHub
  • Move files between commits
  • 2 Solutions collect form web for “Rotate master branch into feature branch”

    You don’t need to “copy” your current master branch, you simply create a feature-1 branch on top of the current master and push it to origin.

    git checkout master
    git checkout -b feature-1
    git push -u origin feature-1 # only needed once
    

    Note the -u option for the first push of feature-1 branch. You won’t need a git set-upstream to link your local branch to a remote branch of the same name on origin.
    See “Git: Why do I need to do --set-upstream all the time?” for more.

    All you need to do is

    git checkout -b feature-1 master
    git push -u origin feature-1
    

    Git will automatically push feature-1 next time you issue git push. It does not matter what branch you are on. When you issue the git push command, git will push whatever branches you have explicitly pushed before to the first remote – but only the ones you have explicitly pushed to that remote. If you have more than one remote you can specify which one git push origin or git push upstream. If you explicitly want to push just one branch to a remote you need to git push origin branch-name.

    Tracking (what branch gets updated on the remote when you git push) is handled more implicitly with the latest versions of git.

    For open source, typically someone may have 2 remotes:

    1. a remote for their own fork of a projet.
    2. a second remote that’s read only and can’t be pushed to for the main repo of the project.

    This is where you would want to be explicit about which repo you are referring to at certain times.

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