129 | | go back to your unmodified branch is to make a copy of the branch. This assumes you are working on branch |
130 | | mychanges and want to save your work on branch mychanges_backup, and that you have a remote called upstream |
131 | | that points to the trunk repository: |
| 129 | go back to your unmodified branch is to make a copy of the branch. |
| 130 | |
| 131 | The following summary of commands assumes you are working on branch mychanges and want to save your work on |
| 132 | branch mychanges_backup. It also assumes you have a master branch that mirrors branch master in trunk, and |
| 133 | that you have a remote called upstream that points to the trunk repository. This setup makes it less |
| 134 | convenient to use the {{{git pull --rebase}}} command, as that (now) requires that the remote and local |
| 135 | branch have the same name. Here we show an alternative that does a pull into your local master branch, then |
| 136 | a rebase from your updated master branch into your mychanges branch. |
147 | | # Update your branch from trunk |
148 | | git pull --rebase upstream master:mychanges |
| 156 | # Update your mychanges branch from your (updated) local master |
| 157 | git rebase master |
| 158 | |
| 159 | # If you get a conflict on one of your commits, the rebase will stop and leave files with the |
| 160 | # conflicts marked. See the following section about how to resolve it. After you have edited |
| 161 | # any files that need to be changed, git add them and optionally commit them, then continue the |
| 162 | # rebase. |
| 163 | # Edit as per next section... |
| 164 | git add ... |
| 165 | git rebase --continue |
| 166 | |
| 167 | # If, at any point before the end of the rebase, something goes wrong, or you're just not sure |
| 168 | # what you're doing: |
| 169 | git rebase --abort |
| 170 | |