ℹ️ 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://gitbreeze.dev/git-move-commit-to-another-branch |
| Last Crawled | 2026-04-16 09:19:04 (3 days ago) |
| First Indexed | 2023-01-24 19:41:25 (3 years ago) |
| HTTP Status Code | 200 |
| Meta Title | How to Git Move Commit to Another Branch Effortlessly | GitBreeze |
| Meta Description | You’ve made one or more commits, and now realise they’re on entirely the wrong branch. So how can you make Git move a commit to another branch, either a new branch, or perhaps an existing one? |
| Meta Canonical | null |
| Boilerpipe Text | The Problem
It's the first hour of work, and the tea / coffee / taurine hasn’t kicked in yet. Having created some commits in Git, you now know they are on the wrong branch. Main, to be exact. You can already hear the pedants in the office tutting.
You need to shift these Git commits to another branch, either a new branch, or an existing one. Here’s how to do this.
The Solution for a New Branch
In this example, there are 3 commits to move.
This creates the new branch
my-branch
, containing all the commits:
git branch my-branch
This changes master. It deletes the last 3 commits, and resets the index and working files:
git reset --hard HEAD~3
Or:
To stop the reset if there are changed working files that would get destroyed by
--hard
, then use
--keep
instead:
git reset --keep HEAD~3
This makes
my-branch
the current branch, so you can work on it:
git checkout my-branch
Warning
:Â If after doing this you need to rebase this new branch onto the master, you may need to use
--no-fork-point
to protect your moved commits, otherwise they might get erased.
The Solution for an Existing Branch
In this swift example, there are only 4 commits to move.
This switches you to the branch you want the commits on,
my-branch
:
git checkout my-branch
This merges the
master
into
my-branch
, bringing all its commits:
git merge master
This makes
master
the current branch again:
git checkout master
This changes
master
. It deletes the last 4 commits, and resets the index and working files:
git reset --hard HEAD~4
Or:
To stop the reset if there are changed working files that would get destroyed by
--hard
, then use
--keep
instead:
git reset --keep HEAD~4
This switches you back to
my-branch
to admire the results:
git checkout my-branch
If you want the simplest and easiest solution to this problem though, why not
try our Git client
.
Free
GitBreeze is the AI Git GUIÂ that'sÂ
free to use at work, at home, or anywhere
. GitBreeze works on
Windows, macOS, and Linux.
Designed from the ground up for developers who want Git to be clean and easy, our unique UI/UX boosts your software development -
learn more and reap the benefits
.
Help & tools
We have a
resources
page gives an overview of how we can help you as a software engineer. And you can see our
Git tips & tools
list here.
We also have these free downloads:
25 design patterns
Git cheat sheet
Git tips PDF
Customers say...
I love any tool that makes my life easier... This is
perfect, just the right amount of control
. No more, no less. Easy to get started, push and rollback changes... It's a no brainer!
Hayden T. |
| Markdown | [](https://gitbreeze.dev/)
Menu
- [Resources](https://gitbreeze.dev/resources)
- [Pricing](https://gitbreeze.dev/pricing)
- [Blog](https://gitbreeze.dev/blog)
close
[Free Git GUI](https://gitbreeze.dev/downloads)
[Other platforms](https://gitbreeze.dev/downloads)
# How to Git Move Commit to Another Branch Effortlessly

## The Problem
It's the first hour of work, and the tea / coffee / taurine hasn’t kicked in yet. Having created some commits in Git, you now know they are on the wrong branch. Main, to be exact. You can already hear the pedants in the office tutting.
You need to shift these Git commits to another branch, either a new branch, or an existing one. Here’s how to do this.
## The Solution for a New Branch
In this example, there are 3 commits to move.
This creates the new branch **my-branch**, containing all the commits:

```
git branch my-branch
```
This changes master. It deletes the last 3 commits, and resets the index and working files:
```
git reset --hard HEAD~3
```
**Or:** To stop the reset if there are changed working files that would get destroyed by **\--hard**, then use **\--keep** instead:
```
git reset --keep HEAD~3
```
This makes **my-branch** the current branch, so you can work on it:
```
git checkout my-branch
```
**Warning**: If after doing this you need to rebase this new branch onto the master, you may need to use **\--no-fork-point** to protect your moved commits, otherwise they might get erased.
## The Solution for an Existing Branch
In this swift example, there are only 4 commits to move.
This switches you to the branch you want the commits on, **my-branch**:
```
git checkout my-branch
```
This merges the **master** into **my-branch**, bringing all its commits:
```
git merge master
```
This makes **master** the current branch again:
```
git checkout master
```
This changes **master**. It deletes the last 4 commits, and resets the index and working files:
```
git reset --hard HEAD~4
```
**Or:** To stop the reset if there are changed working files that would get destroyed by **\--hard**, then use **\--keep** instead:
```
git reset --keep HEAD~4
```
This switches you back to **my-branch** to admire the results:
```
git checkout my-branch
```
If you want the simplest and easiest solution to this problem though, why not [try our Git client](https://gitbreeze.dev/git-client).
# Free
GitBreeze is the AI Git GUI that's **free to use at work, at home, or anywhere**. GitBreeze works on **Windows, macOS, and Linux.**
Designed from the ground up for developers who want Git to be clean and easy, our unique UI/UX boosts your software development - [learn more and reap the benefits](https://gitbreeze.dev/).
# Help & tools
We have a [resources](https://gitbreeze.dev/resources) page gives an overview of how we can help you as a software engineer. And you can see our [Git tips & tools](https://gitbreeze.dev/resources/git) list here.
We also have these free downloads:
- [25 design patterns](https://gitbreeze.dev/c-sharp-design-patterns-net-core-examples)
- [Git cheat sheet](https://gitbreeze.dev/git-cheat-sheet)
- [Git tips PDF](https://gitbreeze.dev/white-paper-7-intermediate-git-tips)
# Customers say...
I love any tool that makes my life easier... This is **perfect, just the right amount of control**. No more, no less. Easy to get started, push and rollback changes... It's a no brainer\!
Hayden T.
[Free Git GUI](https://gitbreeze.dev/downloads)
[Other platforms](https://gitbreeze.dev/downloads)
### Related posts
[How to Overwrite Local Files Not Git Commits Effortlessly](https://gitbreeze.dev/overwrite-local-files-but-keep-un-pushed-commits "How to Overwrite Local Files Not Git Commits Effortlessly") [How to Git Rebase Instead of Merge Effortlessly](https://gitbreeze.dev/git-rebase-instead-of-merge "How to Git Rebase Instead of Merge Effortlessly") [How to Git Reset Effortlessly](https://gitbreeze.dev/git-reset "How to Git Reset Effortlessly")

© 2026 GitBreeze Ltd.

Menu
- [Home](https://gitbreeze.dev/)
- [Downloads](https://gitbreeze.dev/downloads)
- [Features](https://gitbreeze.dev/features)
- [Pricing](https://gitbreeze.dev/pricing)
- [Resources](https://gitbreeze.dev/resources)
- [Git Client](https://gitbreeze.dev/git-client)
close
Menu
- [Blog](https://gitbreeze.dev/blog)
- [Privacy Policy](https://gitbreeze.dev/about/privacy-policy)
- [Cookie Policy](https://gitbreeze.dev/about/cookie-policy)
- [Terms & Conditions](https://gitbreeze.dev/about/terms-conditions)
- [About](https://gitbreeze.dev/about)
- [Help](https://help.gitbreeze.dev/)
close |
| Readable Markdown | 
## The Problem
It's the first hour of work, and the tea / coffee / taurine hasn’t kicked in yet. Having created some commits in Git, you now know they are on the wrong branch. Main, to be exact. You can already hear the pedants in the office tutting.
You need to shift these Git commits to another branch, either a new branch, or an existing one. Here’s how to do this.
## The Solution for a New Branch
In this example, there are 3 commits to move.
This creates the new branch **my-branch**, containing all the commits:

```
git branch my-branch
```
This changes master. It deletes the last 3 commits, and resets the index and working files:
```
git reset --hard HEAD~3
```
**Or:** To stop the reset if there are changed working files that would get destroyed by **\--hard**, then use **\--keep** instead:
```
git reset --keep HEAD~3
```
This makes **my-branch** the current branch, so you can work on it:
```
git checkout my-branch
```
**Warning**: If after doing this you need to rebase this new branch onto the master, you may need to use **\--no-fork-point** to protect your moved commits, otherwise they might get erased.
## The Solution for an Existing Branch
In this swift example, there are only 4 commits to move.
This switches you to the branch you want the commits on, **my-branch**:
```
git checkout my-branch
```
This merges the **master** into **my-branch**, bringing all its commits:
```
git merge master
```
This makes **master** the current branch again:
```
git checkout master
```
This changes **master**. It deletes the last 4 commits, and resets the index and working files:
```
git reset --hard HEAD~4
```
**Or:** To stop the reset if there are changed working files that would get destroyed by **\--hard**, then use **\--keep** instead:
```
git reset --keep HEAD~4
```
This switches you back to **my-branch** to admire the results:
```
git checkout my-branch
```
If you want the simplest and easiest solution to this problem though, why not [try our Git client](https://gitbreeze.dev/git-client).
## Free
GitBreeze is the AI Git GUI that's **free to use at work, at home, or anywhere**. GitBreeze works on **Windows, macOS, and Linux.**
Designed from the ground up for developers who want Git to be clean and easy, our unique UI/UX boosts your software development - [learn more and reap the benefits](https://gitbreeze.dev/).
## Help & tools
We have a [resources](https://gitbreeze.dev/resources) page gives an overview of how we can help you as a software engineer. And you can see our [Git tips & tools](https://gitbreeze.dev/resources/git) list here.
We also have these free downloads:
- [25 design patterns](https://gitbreeze.dev/c-sharp-design-patterns-net-core-examples)
- [Git cheat sheet](https://gitbreeze.dev/git-cheat-sheet)
- [Git tips PDF](https://gitbreeze.dev/white-paper-7-intermediate-git-tips)
## Customers say...
I love any tool that makes my life easier... This is **perfect, just the right amount of control**. No more, no less. Easy to get started, push and rollback changes... It's a no brainer\!
Hayden T. |
| Shard | 145 (laksa) |
| Root Hash | 10936048038144166945 |
| Unparsed URL | dev,gitbreeze!/git-move-commit-to-another-branch s443 |