move commits to another branch

# Note: Any changes not committed will be lost.
git branch newbranch      # Create a new branch, saving the desired commits
git reset --hard HEAD~3   # Move master back by 3 commits (Make sure you know how many commits you need to go back)
git checkout newbranch    # Go to the new branch that still has the desired commits

3.9
10
Awgiedawgie 440220 points

                                    git checkout existingbranch
git branch newBranch
git reset --hard HEAD~2 # go back 2 commits on existingBranch

3.9 (10 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
how to move git commit to another branch move local commits to another branch how to move a branch to a commit how to move a commit from one branch to another move commits to a branch move latest git commit to new branch move to commit in branch git move commit to existing branch move to commit branch move one commit to another branch move commit work to new branch move commited work to new branch take commits to another branch git git move commits to existing branch git move commit from branch to other move a commit from one branch to another git move local commit to another branch git move branch on commit how to move multiple commits to another branch move some commits to a new branch move master commits to branch how to move commits to a different branch git how to move commits to another branch git move commits from one branch to another how to move commits from one branch to another git move branch to other commit move some commits to another branch move some commit to another branch git move a commit to another branch how to move a commit to another branch how to move commit from one branch to another how to move commits to another branch git git move all commits to new branch git move past few commits to ew branch move a commit to a different branch git move commit from one branch to another move git commit from one branch to another how to move new commit to next branch move commit from one branch to another can i move my commits from one branch to another git move commit to another branch git move last commit to new branch move a branch to a commit move last commit to a new branch move commit to new branch git move git commit to a new branch how to move commit to a new branch git move last commit to another branch move commit branch git move the last n commits to a new branch move the last commit to another branch git move previous commit to new branch move commit to branch move branch head to last commit move last commit to new branch git move commit from branch move commit to new branch git move the last commit to another branch move branch to commit git move latest commit to another branch git move branch to commit move commit from master to new branch git move commit into new branch git move recent commits to new branch git move branch back one commit git move latest commit to branch how to move the last commit from a git branch to another move commits from branch to other move commit to other branch change our branch to last commit move commit on another branch move commit on master to branch move commits to another branch move two commits to another branch git move commit to branch how to move commits to another branch move a commit to another branch how move commit in current git git commit change branch move commit to another branch how to move commit from new branch to an existing branch how to move commit from new branch to an old branch how to move commit from one branch to another branch git move commits to another branch how to move a commit over to new branch git move ocmmit to another branch git move latest commit to new branch
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source