| | 153 | === If something went wrong === |
| | 154 | |
| | 155 | The following may wreak havoc if someone has forked your branches. If not, it should be relatively safe. |
| | 156 | |
| | 157 | ==== On `master` ==== |
| | 158 | |
| | 159 | You can reset `master` to a one-to-one copy of `upstream` as follows: |
| | 160 | {{{ |
| | 161 | git reset --hard upstream/master |
| | 162 | git push --force |
| | 163 | }}} |
| | 164 | |
| | 165 | ==== On a branch ==== |
| | 166 | |
| | 167 | You can manually remove or glue commits together with |
| | 168 | {{{ |
| | 169 | git rebase -i master |
| | 170 | }}} |
| | 171 | |
| | 172 | To abort the rebase, just remove all non-commented lines. |
| | 173 | |
| | 174 | You may need to use `--force` to push changes back to !GitHub |
| | 175 | {{{ |
| | 176 | git push --force |
| | 177 | }}} |
| | 178 | |
| | 179 | If something went wrong during rebase and you want to undo the rebase: |
| | 180 | |
| | 181 | 1. Find out the state identifier before the rebase: |
| | 182 | {{{ |
| | 183 | git reflog |
| | 184 | }}} |
| | 185 | 1. Switch back to that state |
| | 186 | {{{ |
| | 187 | git reset --hard HEAD@{NUMBER_FROM_REFLOG_HERE} |
| | 188 | }}} |
| | 189 | |