| | 80 | |
| | 81 | == Squashing several commits into one == |
| | 82 | After cherry-picking serveral commits into one new clean base one can consolidate the commits into one using the following commands: |
| | 83 | |
| | 84 | In the following example i have been working on the cm-10.2 branch and now want to consolidate all my last commits into one. The result should be in the cm-10.2 branch again. |
| | 85 | |
| | 86 | Move the current branch |
| | 87 | {{{ |
| | 88 | git branch -m cm-10.2 cm-10.2_pff |
| | 89 | }}} |
| | 90 | Checkout the original branch again and merge the working branch. |
| | 91 | {{{ |
| | 92 | git checkout -b cm-10.2 origin/cm-10.2 |
| | 93 | git merge cm-10.2_pff |
| | 94 | }}} |
| | 95 | Reset the cm-10.2 branch to the original state. |
| | 96 | {{{ |
| | 97 | git reset origin/cm-10.2 |
| | 98 | }}} |
| | 99 | Now all the changes are unstaged and one can add and commit them again in one consolidated commit. |
| | 100 | {{{ |
| | 101 | git add -A |
| | 102 | git commit |
| | 103 | }}} |