🕷️ Crawler Inspector

URL Lookup

Direct Parameter Lookup

Raw Queries and Responses

1. Shard Calculation

Query:
Response:
Calculated Shard: 48 (from laksa128)

2. Crawled Status Check

Query:
Response:

3. Robots.txt Check

Query:
Response:

4. Spam/Ban Check

Query:
Response:

5. Seen Status Check

ℹ️ Skipped - page is already crawled

📄
INDEXABLE
✅
CRAWLED
2 days ago
🤖
ROBOTS ALLOWED

Page Info Filters

FilterStatusConditionDetails
HTTP statusPASSdownload_http_code = 200HTTP 200
Age cutoffPASSdownload_stamp > now() - 6 MONTH0.1 months ago
History dropPASSisNull(history_drop_reason)No drop reason
Spam/banPASSfh_dont_index != 1 AND ml_spam_score = 0ml_spam_score=0
CanonicalPASSmeta_canonical IS NULL OR = '' OR = src_unparsedNot set

Page Details

PropertyValue
URLhttps://www.spkaa.com/blog/how-to-move-git-commits-from-one-branch-to-another
Last Crawled2026-04-09 08:11:42 (2 days ago)
First Indexed2022-01-13 21:48:01 (4 years ago)
HTTP Status Code200
Meta TitleHow To: Move Git Commits From One Branch to Another - SPK and Associates
Meta Descriptionnull
Meta Canonicalnull
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
![fbpx](https://www.facebook.com/tr?id=420815413424177&ev=PageView&noscript=1) 1-888-310-4540 (main) / 1-888-707-6150 (support) [info@spkaa.com](mailto:info@spkaa.com) [![SPK and Associates](https://www.spkaa.com/wp-content/uploads/2023/06/spk-logo-tm-2023.png)](https://www.spkaa.com/) - [Services](https://www.spkaa.com/services) - - - [![](https://www.spkaa.com/wp-content/uploads/2021/10/Product-teardown-amico-150x150.png)](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/wp-content/uploads/2021/10/Product-iteration-amico-1-150x150.png)](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/wp-content/uploads/2024/07/SPK-ACEs-v2-1-275x300.png)](https://www.spkaa.com/about/spk-aces) - - - [![](https://www.spkaa.com/wp-content/uploads/2021/10/Cloud-hosting-amico-150x150.png)](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/wp-content/uploads/2021/10/Data-processing-amico-150x150.png)](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) - - - [![Atlassian Gold Solution Partner Logo](https://www.spkaa.com/wp-content/uploads/2025/03/atlassian-gold-solution-partner-logo.png)](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/) [![GitLab Professional Services Partner Logo](https://www.spkaa.com/wp-content/uploads/2025/03/gitlab-professional-services-partner-logo.png)](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) [![Tulip MES Partner Logo](https://www.spkaa.com/wp-content/uploads/2025/11/spk-tulip-header-partner-logo.png)](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) [![Microsoft Partner Logo](https://www.spkaa.com/wp-content/uploads/2025/03/microsoft-partner-logo.png)](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) - - [![PTC Partner Network Logo](https://www.spkaa.com/wp-content/uploads/2025/03/ptc-partner-network.png)](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) [![Dassault Systèmes Logo](https://www.spkaa.com/wp-content/uploads/2025/03/dassault-systemes-logo.png)](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) [![AWS Partner Logo](https://www.spkaa.com/wp-content/uploads/2025/03/aws-partner-logo.png)](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) - - ![SPK other services](https://www.spkaa.com/wp-content/uploads/2025/03/Other-Services.png) [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 - [![](https://www.spkaa.com/wp-content/uploads/2026/04/essential-cad-workflows-for-faster-product-development-featured-image-150x150.png)Essential CAD Workflows for Faster Product Development](https://www.spkaa.com/blog/essential-cad-workflows-for-faster-product-development) April 3, 2026 - [![](https://www.spkaa.com/wp-content/uploads/2026/04/the-top-7-engineering-tool-integrations-that-drive-faster-time-to-market-featured-image-150x150.png)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 - [![](https://www.spkaa.com/wp-content/uploads/2026/04/the-intelligent-product-lifecycle-how-industrial-companies-are-transforming-with-ai-and-product-data-featured-image-150x150.png)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 [![](https://www.spkaa.com/wp-content/uploads/2026/01/AI-Digital-Threads-Driving-Manufacturing-Productivity-Without-Increasing-Headcount-featured-image-watch-now.png) AI + Digital Threads- Driving Manufacturing Productivity Without Increasing Headcount](https://www.spkaa.com/webinars/ai-digital-threads-driving-manufacturing-productivity-without-increasing-headcount) [![](https://www.spkaa.com/wp-content/uploads/2023/11/eBook-The-DevOps-Starter-Guide-FEATURED-IMAGE.png) 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 ![windchill features best plm software](https://www.spkaa.com/wp-content/uploads/2018/04/spk-git-featured-image.png) ![](https://www.spkaa.com/wp-content/uploads/2023/09/spk-blogpost-author-profile-150x150.jpg) 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 [![Access & Identity Governance in the Atlassian Stack: A Playbook for IT & Security Teams](https://www.spkaa.com/wp-content/uploads/2026/04/Access-Identity-Governance-in-the-Atlassian-Stack-A-Playbook-for-IT-Security-Teams-featured-image-400x250.png)](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 [![The Top 7 Engineering Tool Integrations That Drive Faster Time to Market](https://www.spkaa.com/wp-content/uploads/2026/04/the-top-7-engineering-tool-integrations-that-drive-faster-time-to-market-featured-image-400x250.png)](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... [![Building a Connected Technology Ecosystem Across IT and Engineering](https://www.spkaa.com/wp-content/uploads/2026/04/Building-a-Connected-Technology-Ecosystem-Across-IT-and-Engineering-featured-image-400x250.png)](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.... [![Reducing Vehicle Lifecycle Costs through Data-Driven Collaboration](https://www.spkaa.com/wp-content/uploads/2026/04/Reducing-Vehicle-Lifecycle-Costs-through-Data-Driven-Collaboration-featured-image-400x250.png)](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. ![spk-logo-white-text-short2](https://www.spkaa.com/wp-content/uploads/2023/07/SPK-logo-PNG-white.png) 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) [![Building a Connected Technology Ecosystem Across IT and Engineering](https://www.spkaa.com/wp-content/uploads/2026/04/Building-a-Connected-Technology-Ecosystem-Across-IT-and-Engineering-featured-image-1080x675.png)](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") [![WBENC-white](https://www.spkaa.com/wp-content/uploads/2021/12/WBENC-white.png)](https://www.spkaa.com/about/) [![WBENC-white](https://www.spkaa.com/wp-content/uploads/2024/09/aicpa-soc-logo-transparent-bg.png)](https://www.spkaa.com/about/) © 2026 SPK and Associates, LLC. All Rights Reserved. [![ClickCease](https://monitor.clickcease.com/stats/stats.aspx)](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
![windchill features best plm software](https://www.spkaa.com/wp-content/uploads/2018/04/spk-git-featured-image.png) ![](https://www.spkaa.com/wp-content/uploads/2023/09/spk-blogpost-author-profile-150x150.jpg) 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
Shard48 (laksa)
Root Hash9673312464776226248
Unparsed URLcom,spkaa!www,/blog/how-to-move-git-commits-from-one-branch-to-another s443