move Git commits to new branch so I can change name of branch

Discussion in 'iOS Programming' started by patent10021, Mar 26, 2016.

  1. patent10021, Mar 26, 2016
    Last edited: Mar 26, 2016

    patent10021 macrumors 68030


    Apr 23, 2004
    I have 10 commits on a local branch1 used for new features that I want to move to a new local branch2 simply so I can use a more appropriate branch name because the branch1 name I'm using now is ambiguous. As mentioned the current local branch1 with the 10 commits is not the master so no problem there. All commits are local. Nothing pushed to remote yet.

    EDIT: Oh wow. You can simply click rename branch in GitHub for desktop. Or just
    git branch -m <newname>.

    So I've renamed the current local branch and done all my local commits. I'm ready to make a pull request but what should I do first?

    Should I first push to origin which is my GitHub repo (it's actually a fork of someone's project) or should I do the pull request first?
  2. mfram macrumors 65816

    Jan 23, 2010
    San Diego, CA USA
    Checkout branch1 and then create a new branch branch2 at that point. Then keep using branch2. How is that not what you want?
  3. patent10021, Mar 28, 2016
    Last edited: Mar 28, 2016

    patent10021 thread starter macrumors 68030


    Apr 23, 2004
    I just renamed it in GitHub app or command line. Easy.

    I created the pull request. It's still open and the owner has created a new branch5 and wants me to point my same pull request to the new branch5.

    Do I just go back to GitHub desktop and submit a new pull request to the new branch5 or can I just change the destination of the previous pull request in some GitHub settings?

    btw, why doesn't he just pull it then merge it himself?

    Never mind. It was easy.
  4. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State

Share This Page