âšď¸ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0.1 months ago |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://www.spkaa.com/blog/how-to-move-git-commits-from-one-branch-to-another |
| Last Crawled | 2026-04-09 08:11:42 (2 days ago) |
| First Indexed | 2022-01-13 21:48:01 (4 years ago) |
| HTTP Status Code | 200 |
| Meta Title | How To: Move Git Commits From One Branch to Another - SPK and Associates |
| Meta Description | null |
| Meta Canonical | null |
| Boilerpipe Text | Written by SPK Blog Post
Published on April 11, 2018
Git encourages developers to use branches during their
development process
as a means of coordinating and managing changes to the master branch. Git does not force any particular strategy for doing so and consequently, several popular branching strategies have emerged.
Regardless of the of branching strategy used, you may find yourself in a situation where youâve committed work on âBranch Aâ but then wish you had done the work on âBranch Bâ instead. This could be because you combined work for two different features on the same feature branch or perhaps you were working directly on master without realizing it and you need to transfer your work to a development branch to conform to official process demands. Whatever the case may be, letâs look at how you can move a commit off one branch and onto another so that it no longer appears in the history of the original branch. We will look at how to move the commits to a new branch as well as moving them to an existing branch.
The process for moving work off one branch and onto a newly created branch is the simplest of the two operations.
git checkout
git branch
git reset âhard HEAD~1
In step (1) we make sure that we are on our âsource branchâ â the branch that has the commits we want to move to a new branch. Step (2) creates a new branch that uses the source branch as its starting point. As a result, the new branch will have all the commits currently found in the source branch, including the changes we want moved. After we execute step (2), keep in mind that we are still on the source branch and did not switch to the new branch. In step (3) we delete the commit from the source branch. Using the âreset âhardâ command allows us to revert the workspace back to the way it was at the specified commit. In the case of the example, we supply the shorthand âHEAD~1â which means âgo back one commit from where HEAD is pointingâ. Substituting a different number like â3â (HEAD~3) would jump things back 3 commits. Alternatively, you could supply an explicit commit SHA1 value and the workspace would revert back to that commit. Now weâve reached our goal state in which the new branch has the target commit and the source branch does not â effectively âmovingâ it from one to the other.
If we want to move a commit to an existing branch, we can follow a similar process using merge.
git checkout
git merge
git checkout
git reset âhard HEAD~1
In step (1) we make sure we are on the branch where we want the commit to end up. We then merge in the source branch in step (2). At this point, our target branch should have the work we want transferred. We move back to the source branch in step (3) and, as previously, we delete the commit from the source branch in step (4).
David Hubbell
Senior Software Engineer
SPK and Associates |
| Markdown | 
1-888-310-4540 (main) / 1-888-707-6150 (support) [info@spkaa.com](mailto:info@spkaa.com)
[](https://www.spkaa.com/)
- [Services](https://www.spkaa.com/services)
- - - [](https://www.spkaa.com/product-lifecycle-management/)
- - [Product Lifecycle Management](https://www.spkaa.com/product-lifecycle-management/)
[PDM/PLM Advisory Services](https://www.spkaa.com/services/pdm-plm-advisory-services/)
[Computer System Validation (CSV)](https://www.spkaa.com/services/computer-system-validation/)
[Computer Software Assurance (CSA)](https://www.spkaa.com/services/computer-software-assurance)
[PTC Windchill PLM](https://www.spkaa.com/software/ptc-windchill-product-lifecycle-management-plm) [SOLIDWORKS PDM in the Cloud](https://www.spkaa.com/software/solidworks-pdm-in-the-cloud/)
[SPK vCAD ⢠- Virtual Engineering Platform](https://www.spkaa.com/services/vcad/)
- - [](https://www.spkaa.com/software-lifecycle-management/)
- - [Software Lifecycle Management](https://www.spkaa.com/software-lifecycle-management/)
[Software Delivery Advisory Services](https://www.spkaa.com/services/software-delivery-advisory-services/)
[CI/CD Readiness](https://www.spkaa.com/continuous-integration-continuous-delivery-readiness/)
[DevOps Services](https://www.spkaa.com/services/devops-services)
[Atlassian Solutions](https://www.spkaa.com/software/atlassian)
[GitLabs Solutions](https://www.spkaa.com/software/gitlab)
[PTC Codebeamer Solutions](https://www.spkaa.com/software/codebeamer)
- - [](https://www.spkaa.com/about/spk-aces)
- - - [](https://www.spkaa.com/cloud-for-engineering/)
- - [Cloud for Engineering](https://www.spkaa.com/cloud-for-engineering)
[Cloud Advisory Services](https://www.spkaa.com/services/cloud-advisory-services/)
[Managed Services](https://www.spkaa.com/services/managed-services/)
[AWS Solutions](https://www.spkaa.com/cloud-for-engineering/aws-solutions/)
[Azure Solutions](https://www.spkaa.com/cloud-for-engineering/azure-solutions/)
- - [](https://www.spkaa.com/data-engineering-and-analytics)
- - [Data Engineering & Analytics](https://www.spkaa.com/data-engineering-and-analytics)
[Data Advisory Services](https://www.spkaa.com/services/data-advisory-services/)
[Data Analytics Services](https://www.spkaa.com/services/data-analytics-services/)
[Microsoft Power BI Services](https://www.spkaa.com/software/microsoft-powerbi/)
[**NEW** AI Launchpad](https://www.spkaa.com/services/artificial-intelligence-machine-learning/ai-launchpad)
- [Solutions](https://www.spkaa.com/software)
- - - [](https://www.spkaa.com/software/atlassian)
[Atlassian Licensing](https://www.spkaa.com/software/atlassian/licensing)
[Atlassian Training](https://www.spkaa.com/software/atlassian/training)
[Atlassian Application Management](https://www.spkaa.com/services/atlassian-application-management)
[Atlassian Migrations](https://www.spkaa.com/software/atlassian/migrations/)
[Atlassian Cloud Readiness](https://www.spkaa.com/software/atlassian/cloud-readiness/)
[](https://www.spkaa.com/software/gitlab)
[GitLab Implementations](https://www.spkaa.com/software/gitlab/gitlab-implementation-quick-start)
[GitLab Application Management](https://www.spkaa.com/services/gitlab-application-management-services)
[GitLab Health Check](https://www.spkaa.com/software/gitlab/gitlab-health-check)
[GitLab DevSecOps App Transformation](https://www.spkaa.com/software/gitlab/gitlab-devsecops-app-transformation)
[](https://www.spkaa.com/software/tulip)
[Tulip Optimization Workshop](https://www.spkaa.com/software/tulip/tulip-optimization-workshop)
[Tulip Application Management](https://www.spkaa.com/software/tulip/tulip-application-management)
[](https://www.spkaa.com/software/microsoft-solutions)
[Azure Solutions](https://www.spkaa.com/cloud-for-engineering/azure-solutions)
[Microsoft Licensing](https://www.spkaa.com/software/microsoft-solutions/licensing)
[Power BI Solutions](https://www.spkaa.com/software/microsoft-powerbi)
[Power BI Training](https://www.spkaa.com/software/microsoft-powerbi/training)
[Power BI Consulting Services](https://www.spkaa.com/software/microsoft-powerbi/consulting-services)
- - [](https://www.spkaa.com/software/ptc)
[Codebeamer Implementations](https://www.spkaa.com/software/codebeamer)
[Codebeamer Licensing](https://www.spkaa.com/software/codebeamer/license-overview)
[Codebeamer Cloud Hosting](https://www.spkaa.com/software/codebeamer/hosting-plans)
[Codebeamer Application Management](https://www.spkaa.com/services/codebeamer-application-management-services)
[Windchill RV\&S](https://www.spkaa.com/software/ptc-windchill-rvs/)
[Windchill RV\&S Productivity Add-Ons](https://www.spkaa.com/software/ptc-windchill-rvs/productivity-add-ons/)
[Creo](https://www.spkaa.com/software/ptc-creo) \| [Creo+](https://www.spkaa.com/software/ptc-creo-plus)
[Creo on vCAD](https://www.spkaa.com/services/vcad)
[Windchill Implementations](https://www.spkaa.com/software/ptc-windchill-product-lifecycle-management-plm)
[Windchill Cloud Hosting](https://www.spkaa.com/software/ptc-windchill-product-lifecycle-management-plm/windchill-cloud-hosting)
[Windchill Application Management](https://www.spkaa.com/services/ptc-windchill-application-management-services)
[Windchill+ Implementations](https://www.spkaa.com/software/ptc-windchill-plus)
[](https://www.spkaa.com/software/solidworks)
[SOLIDWORKS Licensing](https://www.spkaa.com/software/solidworks/licensing)
[SOLIDWORKS Training](https://www.spkaa.com/software/solidworks/training)
[SOLIDWORKS PDM Application Management](https://www.spkaa.com/services/solidworks-pdm-application-management-services)
[SOLIDWORKS PDM in the Cloud](https://www.spkaa.com/software/solidworks-pdm-in-the-cloud)
[SOLIDWORKS on vCAD](https://www.spkaa.com/services/vcad)
[](https://www.spkaa.com/cloud-for-engineering/aws-solutions)
[AWS Solutions](https://www.spkaa.com/cloud-for-engineering/aws-solutions)
[DynamoDB Managed Services](https://www.spkaa.com/cloud-for-engineering/aws-solutions)
[Lambda Managed Services](https://www.spkaa.com/cloud-for-engineering/aws-solutions)
[Redshift Managed Services](https://www.spkaa.com/cloud-for-engineering/aws-solutions)
- - 
[AutoCAD](https://www.spkaa.com/software/others/)
[Altium](https://www.spkaa.com/software/others/)
[Ansys](https://www.spkaa.com/software/ansys)
[Ansible](https://www.spkaa.com/software/others/)
[CloudBees](https://www.spkaa.com/software/cloudbees)
[Cucumber](https://www.spkaa.com/software/cucumber)
[Docker](https://www.spkaa.com/software/docker)
[Google Workspace](https://www.spkaa.com/services/managed-services/google-workspace-managed-services)
[Grafana](https://www.spkaa.com/software/others)
[Graphite](https://www.spkaa.com/software/others)
[Greenlight Guru](https://www.spkaa.com/software/greenlight-guru)
[Klocwork](https://www.spkaa.com/software/others)
[Kubernetes](https://www.spkaa.com/software/kubernetes)
[Labview](https://www.spkaa.com/software/others)
[MasterControl](https://www.spkaa.com/software/mastercontrol-services)
[MatLab](https://www.spkaa.com/software/others)
[Matillion](https://www.spkaa.com/software/others)
[MongoDB](https://www.spkaa.com/software/others)
[Oracle Agile PLM](https://www.spkaa.com/software/others)
[Puppet](https://www.spkaa.com/software/puppet)
[Selenium](https://www.spkaa.com/software/selenium)
[SmartBear Zephyr](https://www.spkaa.com/software/others)
[Snowflake](https://www.spkaa.com/software/others)
[Tableau Server](https://www.spkaa.com/software/tableau)
[Terraform](https://www.spkaa.com/software/terraform)
- - - #### Other Software Experience
[AutoCAD Altium](https://www.spkaa.com/software/others/)
[Ansys](https://www.spkaa.com/software/ansys)
[Ansible AWS Lambda AWS Redshift](https://www.spkaa.com/software/others/) [Cucumber](https://www.spkaa.com/software/cucumber)
[Docker](https://www.spkaa.com/software/docker)
[DynamoDB](https://www.spkaa.com/software/others/) [Dassault 3D Experience](https://www.spkaa.com/software/3dexperience)
[Dassault Enovia Grafana Graphite](https://www.spkaa.com/software/others)
[Greenlight Guru](https://www.spkaa.com/software/greenlight-guru)
[Klocwork](https://www.spkaa.com/software/others)
[Kubernetes](https://www.spkaa.com/software/kubernetes)
[Labview MatLab Matillion](https://www.spkaa.com/software/others) [MongoDB Oracle Agile PLM PTC Creo PTC Windchill](https://www.spkaa.com/software/others)
[Puppet](https://www.spkaa.com/software/puppet)
[Selenium](https://www.spkaa.com/software/selenium)
[SmartBear Snowflake](https://www.spkaa.com/software/others)
[Tableau Server](https://www.spkaa.com/software/tableau)
[Terraform](https://www.spkaa.com/software/terraform)
- [Resources](https://www.spkaa.com/resources)
- - - #### Resources
[Blogs](https://www.spkaa.com/resources/blog/)
[Case Studies](https://www.spkaa.com/resources/case-studies)
[Keynote Presentations](https://www.spkaa.com/resources/keynotes)
[Meet the Experts](https://www.spkaa.com/resources/meet-the-experts)
[Webinars](https://www.spkaa.com/resources/webinars)
[White Papers](https://www.spkaa.com/resources/whitepapers)
- #### Topics
[Atlassian](https://www.spkaa.com/blog/category/atlassian)
[AWS](https://www.spkaa.com/blog/category/aws/)
[Data Engineering](https://www.spkaa.com/blog/category/data-engineering/)
[DevOps](https://www.spkaa.com/blog/category/devops)
[PTC](https://www.spkaa.com/blog/category/ptc)
[**All**](https://www.spkaa.com/resources/)
- - #### Latest Blog Posts
- [Essential CAD Workflows for Faster Product Development](https://www.spkaa.com/blog/essential-cad-workflows-for-faster-product-development)
April 3, 2026
- [The Top 7 Engineering Tool Integrations That Drive Faster Time to Market](https://www.spkaa.com/blog/the-top-7-engineering-tool-integrations-that-drive-faster-time-to-market)
April 3, 2026
- [The Intelligent Product Lifecycle: How Industrial Companies Are Transforming With AI + Product Data](https://www.spkaa.com/blog/the-intelligent-product-lifecycle-how-industrial-companies-are-transforming-with-ai-product-data)
April 3, 2026
- - #### Most Popular Resources
[ AI + Digital Threads- Driving Manufacturing Productivity Without Increasing Headcount](https://www.spkaa.com/webinars/ai-digital-threads-driving-manufacturing-productivity-without-increasing-headcount)
[ The DevOps Starter Guide](https://www.spkaa.com/white-paper/the-devops-starter-guide)
- [Partners](https://www.spkaa.com/partners)
- [About](https://www.spkaa.com/about)
- [Contact](https://www.spkaa.com/contact)
Select Page
# How To: Move Git Commits From One Branch to Another


Written by SPK Blog Post
Published on April 11, 2018
Categories: [Engineering Operations](https://www.spkaa.com/blog/category/engineering-operations) \| [Integration and Workflow](https://www.spkaa.com/blog/category/integration-and-workflow) \| [Software Development & Release Management](https://www.spkaa.com/blog/category/software-development-release-management)
Git encourages developers to use branches during their [development process](https://www.spkaa.com/services/engineering-collaboration/) as a means of coordinating and managing changes to the master branch. Git does not force any particular strategy for doing so and consequently, several popular branching strategies have emerged.
Regardless of the of branching strategy used, you may find yourself in a situation where youâve committed work on âBranch Aâ but then wish you had done the work on âBranch Bâ instead. This could be because you combined work for two different features on the same feature branch or perhaps you were working directly on master without realizing it and you need to transfer your work to a development branch to conform to official process demands. Whatever the case may be, letâs look at how you can move a commit off one branch and onto another so that it no longer appears in the history of the original branch. We will look at how to move the commits to a new branch as well as moving them to an existing branch.
The process for moving work off one branch and onto a newly created branch is the simplest of the two operations.
1. git checkout
2. git branch
3. git reset âhard HEAD~1
In step (1) we make sure that we are on our âsource branchâ â the branch that has the commits we want to move to a new branch. Step (2) creates a new branch that uses the source branch as its starting point. As a result, the new branch will have all the commits currently found in the source branch, including the changes we want moved. After we execute step (2), keep in mind that we are still on the source branch and did not switch to the new branch. In step (3) we delete the commit from the source branch. Using the âreset âhardâ command allows us to revert the workspace back to the way it was at the specified commit. In the case of the example, we supply the shorthand âHEAD~1â which means âgo back one commit from where HEAD is pointingâ. Substituting a different number like â3â (HEAD~3) would jump things back 3 commits. Alternatively, you could supply an explicit commit SHA1 value and the workspace would revert back to that commit. Now weâve reached our goal state in which the new branch has the target commit and the source branch does not â effectively âmovingâ it from one to the other.
If we want to move a commit to an existing branch, we can follow a similar process using merge.
1. git checkout
2. git merge
3. git checkout
4. git reset âhard HEAD~1
In step (1) we make sure we are on the branch where we want the commit to end up. We then merge in the source branch in step (2). At this point, our target branch should have the work we want transferred. We move back to the source branch in step (3) and, as previously, we delete the commit from the source branch in step (4).
David Hubbell
Senior Software Engineer
SPK and Associates
[â Previous: SPK (Capabilities + Character) = Client Trust (Q1 2018 Newsletter)](https://www.spkaa.com/blog/q1-2018-newsletter) [Next: The 12 Principles Behind the Agile Manifesto: Principle Number Two - Harnessing Change â](https://www.spkaa.com/blog/12-principles-behind-the-agile-manifesto-harnessing-change)
## Latest White Papers
[](https://www.spkaa.com/white-paper/access-identity-governance-in-the-atlassian-stack-a-playbook-for-it-security-teams)
## [Access & Identity Governance in the Atlassian Stack: A Playbook for IT & Security Teams](https://www.spkaa.com/white-paper/access-identity-governance-in-the-atlassian-stack-a-playbook-for-it-security-teams)
Access governance is vital for ensuring data is safe and secure. In this eBook, we will explore how to maintain compliance with security regulations for IT teams utilizing Atlassian tools.What You Will Learn We will explore: Why identity governance matters in...
## Subscribe to our blog
Stay up to date with the latest Engineering Technology tips and news.
## Related Resources
[](https://www.spkaa.com/blog/the-top-7-engineering-tool-integrations-that-drive-faster-time-to-market)
## [The Top 7 Engineering Tool Integrations That Drive Faster Time to Market](https://www.spkaa.com/blog/the-top-7-engineering-tool-integrations-that-drive-faster-time-to-market)
Apr 3, 2026
Itâs very rare that an engineering team operates on a single system in today's product development environment. Instead, requirements management, PLM, ALM, DevOps, QA, and ITSM platforms are all part of a sophisticated ecosystem. While each of these instruments...
[](https://www.spkaa.com/blog/building-a-connected-technology-ecosystem-across-it-and-engineering)
## [Building a Connected Technology Ecosystem Across IT and Engineering](https://www.spkaa.com/blog/building-a-connected-technology-ecosystem-across-it-and-engineering)
Apr 3, 2026
IT and engineering ecosystems are gradually getting more complex, leading most organizations to rely on multiple specialized tools to support different teams. While this approach drives productivity, it often introduces the critical challenge of disconnected systems....
[](https://www.spkaa.com/blog/reducing-vehicle-lifecycle-costs-through-data-driven-collaboration)
## [Reducing Vehicle Lifecycle Costs through Data-Driven Collaboration](https://www.spkaa.com/blog/reducing-vehicle-lifecycle-costs-through-data-driven-collaboration)
Apr 3, 2026
One of the largest causes of inefficiency across industries is disconnected systems. In the automotive industry, software teams need to communicate with product engineers more than ever. Forward-thinking organizations are addressing this challenge by embracing...
### About
SPK and Associates is a leading woman-owned Engineering & IT Services Company that serves product development teams. For over 20 years, we have been helping our customers to harness technology to optimize engineering and attain their business goals. We understand the systems, processes, data and applications critical to successful engineering, and dedicate ourselves to helping you build, test, and release your products faster and better. Our core expertise covers four functional areas: Product Lifecycle Management (PLM, PDM, QMS, MCAD, ECAD); Software Lifecycle Management (ALM, DevOps); Cloud for Engineering (Infrastructure, Security); Data Engineering and Analytics.

People illustrations by [Storyset](https://storyset.com/people)
[Data Privacy Framework Principles](https://www.spkaa.com/eu-us-swiss-us-data-privacy-framework-principles)
[Accessibility Statement](https://www.spkaa.com/accessibility-statement)
### All Content
[Blog](https://www.spkaa.com/resources/blog)
[Case Studies](https://www.spkaa.com/resources/case-studies)
[Webinars](https://www.spkaa.com/resources/webinars)
[White papers](https://www.spkaa.com/resources/whitepapers)
[](https://www.spkaa.com/blog/building-a-connected-technology-ecosystem-across-it-and-engineering)
##### [Building a Connected Technology Ecosystem Across IT and Engineering](https://www.spkaa.com/blog/building-a-connected-technology-ecosystem-across-it-and-engineering)
Apr 3, 2026
IT and engineering ecosystems are gradually getting more complex, leading most organizations to rely on multiple specialized tools to support different teams. While this approach drives productivity, it often introduces the critical challenge of disconnected systems....
### Contact
**Headquarters**
5011 Scotts Valley Drive
Scotts Valley, CA 95066
888-310-4540 (main)
888-707-6150 (support)
info@spkaa.com
- [Follow](https://www.facebook.com/spkaa "Follow on Facebook")
- [Follow](https://twitter.com/spkaa "Follow on X")
- [Follow](https://www.linkedin.com/company/spk-and-associates-llc/ "Follow on LinkedIn")
- [Follow](https://www.instagram.com/spkandassociates/ "Follow on Instagram")
- [Follow](https://www.youtube.com/c/SPKAAIT "Follow on Youtube")
[](https://www.spkaa.com/about/)
[](https://www.spkaa.com/about/)
Š 2026 SPK and Associates, LLC. All Rights Reserved.
[](https://www.clickcease.com/)
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.
Ok
Privacy policy |
| Readable Markdown | 

Written by SPK Blog Post
Published on April 11, 2018
Git encourages developers to use branches during their [development process](https://www.spkaa.com/services/engineering-collaboration/) as a means of coordinating and managing changes to the master branch. Git does not force any particular strategy for doing so and consequently, several popular branching strategies have emerged.
Regardless of the of branching strategy used, you may find yourself in a situation where youâve committed work on âBranch Aâ but then wish you had done the work on âBranch Bâ instead. This could be because you combined work for two different features on the same feature branch or perhaps you were working directly on master without realizing it and you need to transfer your work to a development branch to conform to official process demands. Whatever the case may be, letâs look at how you can move a commit off one branch and onto another so that it no longer appears in the history of the original branch. We will look at how to move the commits to a new branch as well as moving them to an existing branch.
The process for moving work off one branch and onto a newly created branch is the simplest of the two operations.
1. git checkout
2. git branch
3. git reset âhard HEAD~1
In step (1) we make sure that we are on our âsource branchâ â the branch that has the commits we want to move to a new branch. Step (2) creates a new branch that uses the source branch as its starting point. As a result, the new branch will have all the commits currently found in the source branch, including the changes we want moved. After we execute step (2), keep in mind that we are still on the source branch and did not switch to the new branch. In step (3) we delete the commit from the source branch. Using the âreset âhardâ command allows us to revert the workspace back to the way it was at the specified commit. In the case of the example, we supply the shorthand âHEAD~1â which means âgo back one commit from where HEAD is pointingâ. Substituting a different number like â3â (HEAD~3) would jump things back 3 commits. Alternatively, you could supply an explicit commit SHA1 value and the workspace would revert back to that commit. Now weâve reached our goal state in which the new branch has the target commit and the source branch does not â effectively âmovingâ it from one to the other.
If we want to move a commit to an existing branch, we can follow a similar process using merge.
1. git checkout
2. git merge
3. git checkout
4. git reset âhard HEAD~1
In step (1) we make sure we are on the branch where we want the commit to end up. We then merge in the source branch in step (2). At this point, our target branch should have the work we want transferred. We move back to the source branch in step (3) and, as previously, we delete the commit from the source branch in step (4).
David Hubbell
Senior Software Engineer
SPK and Associates |
| Shard | 48 (laksa) |
| Root Hash | 9673312464776226248 |
| Unparsed URL | com,spkaa!www,/blog/how-to-move-git-commits-from-one-branch-to-another s443 |