Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| git_move_uncommitted_changes_to_topic_branch [2019/03/12 15:14] – created rpjday | git_move_uncommitted_changes_to_topic_branch [2019/03/12 15:20] (current) – [The steps] rpjday | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| How to move a pile of uncommitted changes from '' | How to move a pile of uncommitted changes from '' | ||
| + | |||
| + | ===== The steps ===== | ||
| + | |||
| + | While still on '' | ||
| + | |||
| + | < | ||
| + | $ git tag backup | ||
| + | </ | ||
| + | |||
| + | Commit all your work to '' | ||
| + | |||
| + | < | ||
| + | $ 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 '' | ||
| + | |||
| + | < | ||
| + | $ git cherry-pick backup..master | ||
| + | </ | ||
| + | |||
| + | Switch back to '' | ||
| + | |||
| + | < | ||
| + | $ git checkout master | ||
| + | $ git reset --hard backup | ||
| + | $ git tag -d backup | ||
| + | </ | ||
| + | |||
| + | Note how you can reorganize the commits from '' | ||