On Sun, Jun 14, 2009 at 09:38:55AM -0700, keV wrote: > > Hi! > > I've made some changes in my working tree. When I was about to commit > them I realize that a part of these changes have to be commited into > both current branch and master branch. The another part of changes > have to be commited into the current branch only. What is the best way > to do all this job? > > Evg
Use 'git add -p', git-gui or git-cola [1] to tease the changes apart into a separate commits. Since you're already on the current branch, you should do all of the commits for that branch first. Once you've finished those, choose the rest of the changes (which should be for master) and then commit those in separate commits. Now that all the commits are on your-topic-branch you need to pick the ones you want for master. Switch back to master, 'git log your-topic-branch' and find the SHA-1 IDs for the commits that were meant for master. Use 'git cherry-pick <SHA-1>' to bring in the commits from your-topic-branch. You'll want to cherry-pick them in the same order as you committed them, which means in reverse order from that output by 'git log' (log uses reverse chronological order). Now you have duplicate commits in your-topic-branch. You can use rebase to fix that. git checkout your-topic-branch git rebase -i master Remove the two commits that were cherry-picked into master, save the file, and you're done. [1] http://cola.tuxfamily.org/ -- David --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Git for human beings" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/git-users?hl=en -~----------~----~----~----~------~----~------~--~---
