Move remote branch tip from one branch to another

I did a rebase --onto to move a previous commit (c4) from master to a feature branch. But I had already pushed master to the remote origin.

So currently now I have

  • How do I preserve the timestamp if I split a commit via git rebase --interactive?
  • Git says local branch is ahead of remote after having pulled from remote
  • git find all unmerged commits in master grouped by the branches they were created in
  • Is it possible in git to just push 4 out of 5 commits?
  • is it possible to display the latest commit when i use “git branch”?
  • How to amend a commit without changing commit message (reusing the previous one)?
  • c1 - c2 - c3 - c5(master HEAD)
               \
                c4(feature HEAD) - c5(origin/master HEAD)
    

    I realize that fixing this will screw up anyone who has pulled in changes from origin/master. But there is only one other developer so this is not that much of an issue. How do I change origin/master so it’s not after the feature branch. I’d like it to be this:

    c1 - c2 - c3 - c5(master HEAD)(origin/master HEAD)
               \
                c4(feature HEAD)
    

  • Number of Commits between two Commitishes
  • How do I work with a git repository within another repository?
  • duplicate file error while pushing --mirror into Git repository
  • Git post-receive user input
  • What is the origin of the name 'dcommit' in git svn dcommit?
  • Git: set branch to current ref
  • One Solution collect form web for “Move remote branch tip from one branch to another”

    Use a forced push from master to origin/master:

    git push origin master:master --force
    

    The other developer will need to reset his master to the remote master afterwards (preferably a hard reset after saving his work):

    git fetch origin
    git checkout master
    git reset --hard origin/master
    
    Git Baby is a git and github fan, let's start git clone.