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,260 points
813 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,460 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
2,456 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,230 points
1,602 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,700 points
2,351 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,035 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,460 points
611 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, 2021 in Git & GitHub by MD
• 95,460 points
1,132 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP