This is an old revision of the document!


How to move a pile of uncommitted changes from master to topic, because they should have been on the topic branch in the first place.

Tag the current HEAD for reference later:

$ git tab backup

Commit all your work to master using reasonable commits for later:

$ git add ...
$ git commit ...

$ git add ...
$ git commit ...

Switch to the other branch, which should work fine:

$ git checkout topic

Cherry-pick what you want from master, or just all of it, dealing with merge conflicts as they arise:

$ git cherry-pick backup..master

Switch back to master, wipe out those redundant commits, and delete the now superfluous tag:

$ git checkout master
$ git reset --hard backup
$ git tag -d backup
  • git_move_uncommitted_changes_to_topic_branch.1552403972.txt.gz
  • Last modified: 2019/03/12 15:19
  • by rpjday