How to move the most recent commits to a new branch with Git

0 votes

Hi Guys,

I recently did some commits in the Git Master branch. I want to move them to a new branch. How can I do that?

Dec 22, 2020 in Git & GitHub by akhtar
• 38,170 points
64 views

1 answer to this question.

0 votes

Hi@akhtar,

If you want to move your commits to an existing branch, you can run the below command one by one.

git checkout existingbranch
git merge master
git checkout master
git reset --hard HEAD~3 
git checkout existingbranch
answered Dec 22, 2020 by MD
• 95,160 points

Related Questions In Git & GitHub

0 votes
1 answer

How to do a re-merge into another branch in git

Seems like you want to rebase your ...READ MORE

answered May 7, 2018 in Git & GitHub by DareDev
• 6,890 points
904 views
0 votes
1 answer
0 votes
2 answers

How to view the nested workflow of a local git repository?

The closest way to view branches in ...READ MORE

answered Aug 2, 2019 in Git & GitHub by Sirajul
• 59,050 points
389 views
0 votes
1 answer

How to solve the ‘Git commit -a error’?

This happens when no editor is set. ...READ MORE

answered Jul 5, 2018 in Git & GitHub by Tyrion anex
• 8,660 points
810 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
1,064 views
+2 votes
1 answer
0 votes
1 answer

How to undo the most recent local commits in Git?

Hi@akhtar, There is one way available to undo ...READ MORE

answered Dec 21, 2020 in Git & GitHub by MD
• 95,160 points
58 views
0 votes
1 answer

How to get changes from master branch to a new branch in Git?

Hi@akhtar, You need to check out the branch and ...READ MORE

answered Jan 4 in Git & GitHub by MD
• 95,160 points
83 views