LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-17-2013, 11:18 PM   #1
hydraMax
Member
 
Registered: Jul 2010
Location: Skynet
Distribution: Debian + Emacs
Posts: 467
Blog Entries: 60

Rep: Reputation: 51
git: committed to wrong branch


Hi. I created a new branch in my project with "git branch game-structure" representing some massive, broken structural changes. I committed the changes, but I forgot to switch to the new branch first, so changes were committed to the master branch. I definitely don't want the changes in the master branch. What is the easiest way to transfer the changes into the new branch?

I haven't published (git push) to our central repo yet, so my mistake is still local to my repo.
 
Old 04-17-2013, 11:40 PM   #2
mina86
Member
 
Registered: Aug 2008
Distribution: Debian
Posts: 517

Rep: Reputation: 229Reputation: 229Reputation: 229
Code:
git checkout game-structure
git cherry-pick master
git checkout master
git reset --hard HEAD~
 
1 members found this post helpful.
Old 04-19-2013, 10:13 PM   #3
hydraMax
Member
 
Registered: Jul 2010
Location: Skynet
Distribution: Debian + Emacs
Posts: 467

Original Poster
Blog Entries: 60

Rep: Reputation: 51
Thanks!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Git delete a branch? binladen_vn88 General 4 01-21-2013 12:55 AM
[SOLVED] How can clean delete the "git branch"? poplinux Linux - Software 3 10-17-2012 03:27 AM
git branch changes are changing master? joejoe99 Linux - Software 2 05-01-2012 03:56 PM
How can i update kernel source from git with my own changes in another branch Richard.Yang Linux - Software 16 09-25-2011 01:26 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration