âšď¸ 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://bill.harding.blog/2010/01/08/git-move-commit-to-another-branch/ |
| Last Crawled | 2026-04-03 12:09:14 (3 days ago) |
| First Indexed | 2019-05-07 14:13:54 (6 years ago) |
| HTTP Status Code | 200 |
| Meta Title | Git move commit to another branch â Relentless Simplicity |
| Meta Description | null |
| Meta Canonical | null |
| Boilerpipe Text | Rubymineâs stellar Git integration means that I seldom have to tinker with Git on the command line, but an exception to this is when I switch branches and forget to switch back before making my next commit. Dâoh!
The answer is git cherry-pick.
The syntax is simple:
git cherry-pick [commit ID]
You can run âgit logâ to get the ID of your commit. You can also use a graphical tool like Giggle, which lets you see all commits to all branches.
If you had the misfortune of your checkin not being on any given branch, you can run âgit reflogâ to see all checkins to all branches, and merge your master branch with the fake branch that your checkin went to. See
Stack Overflow
for more details on what to do in this scenario. |
| Markdown | [Skip to content](https://bill.harding.blog/2010/01/08/git-move-commit-to-another-branch/#content)

[Relentless Simplicity](https://bill.harding.blog/)
Somebody has to do something, and it's just incredibly pathetic that it has to be us.
Posted on
[January 8, 2010](https://bill.harding.blog/2010/01/08/git-move-commit-to-another-branch/)
by [Bill](https://bill.harding.blog/author/admin/)
# Git move commit to another branch
Rubymineâs stellar Git integration means that I seldom have to tinker with Git on the command line, but an exception to this is when I switch branches and forget to switch back before making my next commit. Dâoh\!
The answer is git cherry-pick.
The syntax is simple:
```
git cherry-pick [commit ID]
```
You can run âgit logâ to get the ID of your commit. You can also use a graphical tool like Giggle, which lets you see all commits to all branches.
If you had the misfortune of your checkin not being on any given branch, you can run âgit reflogâ to see all checkins to all branches, and merge your master branch with the fake branch that your checkin went to. See [Stack Overflow](http://stackoverflow.com/questions/366093/git-commit-against-tag-with-no-branch) for more details on what to do in this scenario.
Categories[Git](https://bill.harding.blog/category/git/)
## One Reply to âGit move commit to another branchâ
1.  **Gavin** says:
[December 23, 2010 at 2:26 am](https://bill.harding.blog/2010/01/08/git-move-commit-to-another-branch/#comment-492)
Thanks for that; just came in very handy.
I cherry-picked two commits (in the one command) from a branch to master.
That meant I had duplicate commits. I wanted to rebase the branch to master so the branch could take advantage of these commits, but I didnât want the branch to \_contain\_ the commits.
\$ git rebase âonto master 286d5dce1
I trusted git to ignore the duplicate commits. It ignored the first but reapplied the second. I had the same commit twice in my âgit logâ, and the content was even duplicated in the file\!
It was easy to fix this with a âgit rebase -i HEAD~4â and throw away the last commit.
Perhaps if Iâd cherry-picked one commit at a time, git would have detected and ignored the duplicates later. And of course, I could have used interactive rebase to be sureâŚ
[Reply](https://bill.harding.blog/2010/01/08/git-move-commit-to-another-branch/?replytocom=492#respond)
### Leave a Reply [Cancel reply](https://bill.harding.blog/2010/01/08/git-move-commit-to-another-branch/#respond)
## Post navigation
[Previous PostPrevious Javascript play sound (wav, MP3, etc) in one line](https://bill.harding.blog/2010/01/07/play-sound-wav-mp3-etc-with-one-line-of-javascript/)
[Next PostNext Best Linux Git GUI/Browser](https://bill.harding.blog/2010/01/10/best-linux-git-guibrowser/)
## Recent Posts
- [Notes from Montpellier Hertz Return (April 2026)](https://bill.harding.blog/2026/04/02/notes-from-montpellier-hertz-return-april-2026/)
- [Data roundup: Which code models performing best this month (April 2026)?](https://bill.harding.blog/2026/04/02/which-models-are-best-this-month-april-2026/)
- [The Dilbert Afterlife Takeaways: Too Clever by Half](https://bill.harding.blog/2026/01/22/the-dilbert-afterlife-takeaways-too-clever-by-half/)
- [Did the CEO of Google really say that AI only increased productivity by 10%?](https://bill.harding.blog/2025/10/15/did-the-ceo-of-google-really-say-that-ai-only-increased-productivity-by-10/)
- [Incentives make the world go round: are there any other comparable prediction tools?](https://bill.harding.blog/2025/05/05/incentives-they-make-the-world-go-round/)
- [Copilot vs. Cursor vs. Anthropic vs. DeepSeek vs. OpenAI LLM Examples from 2025](https://bill.harding.blog/2025/03/09/copilot-vs-cursor-vs-anthropic-vs-deepseek-vs-openai-llm-examples-from-2025/)
- [Understanding Rruleâs bysetpos property](https://bill.harding.blog/2025/02/02/understanding-rrules-bysetpos-property/)
- [Visual Studio Code (+ Cursor) IDE Setup on macOS for Jetbrains-experienced Programmers](https://bill.harding.blog/2025/02/01/visual-studio-setup-and-use-on-macos-in-2024-for-an-experienced-jetbrains-rubymine-user/)
- [Attention pendulum (goal setting)](https://bill.harding.blog/2024/12/30/attention-pendulum-goal-setting/)
- [Tim Ferriss explains how identifying âsuper tasksâ in his to-do list helps plan his day](https://bill.harding.blog/2024/12/11/tim-ferriss-explains-how-identifying-super-tasks-in-his-to-do-list-helps-plan-his-day/)
## Recent Comments
- Rich on [Fixed: My i7 Intel Dell Laptop is Ridiculously Slow](https://bill.harding.blog/2017/04/08/fixed-my-i7-intel-dell-laptop-is-ridiculously-slow/#comment-15224)
- [INP Technologies](https://www.inp.co.in/) on [Fixed: My i7 Intel Dell Laptop is Ridiculously Slow](https://bill.harding.blog/2017/04/08/fixed-my-i7-intel-dell-laptop-is-ridiculously-slow/#comment-14374)
- gazza on [Twilioâs toll/click fraud runs up big customer bills: what to do?](https://bill.harding.blog/2019/08/13/twilios-incentives-to-allow-customer-fraud/#comment-13960)
- [Naina k](https://dellservicescentre.in//) on [Fixed: My i7 Intel Dell Laptop is Ridiculously Slow](https://bill.harding.blog/2017/04/08/fixed-my-i7-intel-dell-laptop-is-ridiculously-slow/#comment-13840)
- Luca on [Fixed: My i7 Intel Dell Laptop is Ridiculously Slow](https://bill.harding.blog/2017/04/08/fixed-my-i7-intel-dell-laptop-is-ridiculously-slow/#comment-13038)
## Categories
- [AI](https://bill.harding.blog/category/ai/)
- [Competition](https://bill.harding.blog/category/competition/)
- [Design](https://bill.harding.blog/category/design/)
- [Entrepreneurship](https://bill.harding.blog/category/entrepreneurship/)
- [Git](https://bill.harding.blog/category/git/)
- [Hiring](https://bill.harding.blog/category/hiring/)
- [Javascript](https://bill.harding.blog/category/javascript/)
- [Linux](https://bill.harding.blog/category/linux/)
- [Linux to Macbook](https://bill.harding.blog/category/linux-to-macbook/)
- [Motivation](https://bill.harding.blog/category/motivation/)
- [Mysql](https://bill.harding.blog/category/mysql-2/)
- [Networking](https://bill.harding.blog/category/networking/)
- [Productivity](https://bill.harding.blog/category/productivity/)
- [Progress](https://bill.harding.blog/category/progress/)
- [Pursuit of excellence](https://bill.harding.blog/category/pursuit-of-excellence/)
- [Rails](https://bill.harding.blog/category/rails/)
- [Rants](https://bill.harding.blog/category/rants/)
- [Technology](https://bill.harding.blog/category/technology/)
- [Tool Reviews](https://bill.harding.blog/category/tool-reviews/)
- [Tough Decisions](https://bill.harding.blog/category/tough-decisions/)
- [Uncategorized](https://bill.harding.blog/category/uncategorized/)
- [User Experience](https://bill.harding.blog/category/user-experience/)
## Pages
- [About Bill Harding](https://bill.harding.blog/about/)
- [Best software engineering metrics](https://bill.harding.blog/best-software-engineering-metrics/)
- [Bill Harding coding velocity](https://bill.harding.blog/bill-harding-coding-velocity/)
## Meta
- [NoteApps.info](https://www.noteapps.info/)
- [TaskApps.info](https://taskapps.info/)
- [Best Evernote Alternative of 2023](https://www.amplenote.com/best_evernote_alternative_2023)
- [Best Todoist Alternative of 2023](https://www.amplenote.com/best_todoist_alternative_2023)
- [Best Roam Alternative of 2023](https://www.amplenote.com/best_roam_alternative_2023)
- [Log in](https://bill.harding.blog/wp-login.php)
- [Entries feed](https://bill.harding.blog/feed/)
## Plausible
[Proudly powered by WordPress](https://wordpress.org/) |
| Readable Markdown | Rubymineâs stellar Git integration means that I seldom have to tinker with Git on the command line, but an exception to this is when I switch branches and forget to switch back before making my next commit. Dâoh\!
The answer is git cherry-pick.
The syntax is simple:
```
git cherry-pick [commit ID]
```
You can run âgit logâ to get the ID of your commit. You can also use a graphical tool like Giggle, which lets you see all commits to all branches.
If you had the misfortune of your checkin not being on any given branch, you can run âgit reflogâ to see all checkins to all branches, and merge your master branch with the fake branch that your checkin went to. See [Stack Overflow](http://stackoverflow.com/questions/366093/git-commit-against-tag-with-no-branch) for more details on what to do in this scenario. |
| Shard | 31 (laksa) |
| Root Hash | 3973902777444244431 |
| Unparsed URL | blog,harding!bill,/2010/01/08/git-move-commit-to-another-branch/ s443 |