@@ -103,7 +103,7 @@ Here are some common issues you might run into:
103103
104104Git has two ways to update your branch with the newest changes: merging and rebasing.
105105Rust [ uses rebasing] [ no-merge-policy ] . If you make a merge commit, it's not too hard to fix:
106- ` git rebase -i origin /master ` .
106+ ` git rebase -i upstream /master ` .
107107
108108See [ Rebasing] [ #rebasing ] for more about rebasing.
109109
@@ -114,16 +114,16 @@ it will say something like this:
114114
115115```
116116$ git remote -v
117- origin https:// github.com// rust-lang/rust (fetch)
118- origin https:// github.com// rust-lang/rust (push)
119- personal https://github.com/jyn514 /rust (fetch)
120- personal https://github.com/jyn514 /rust (push )
117+ origin git@ github.com:jyn514/ rust.git (fetch)
118+ origin git@ github.com:jyn514/ rust.git (push)
119+ upstream https://github.com/rust-lang /rust (fetch)
120+ upstream https://github.com/rust-lang /rust (fetch )
121121```
122122
123123If you renamed your fork, you can change the URL like this:
124124
125125``` console
126- git remote set-url personal <URL>
126+ git remote set-url origin <URL>
127127```
128128
129129where the ` <URL> ` is your new fork.
@@ -174,6 +174,24 @@ and just want to get a clean copy of the repository back, you can use `git reset
174174git reset --hard master
175175```
176176
177+ ### Git is trying to rebase commits I didn't write?
178+
179+ If you see many commits in your rebase list, or merge commits, or commits by other people that you
180+ didn't write, it likely means you're trying to rebase over the wrong branch. For example, you may
181+ have a ` rust-lang/rust ` remote ` upstream ` , but ran ` git rebase origin/master ` instead of `git rebase
182+ upstream/master`. The fix is to abort the rebase and use the correct branch instead:
183+
184+ ```
185+ git rebase --abort
186+ git rebase -i upstream/master
187+ ```
188+
189+ <details ><summary >Click here to see an example of rebasing over the wrong branch</summary >
190+
191+ ![ Interactive rebase over the wrong branch] ( img/other-peoples-commits.png )
192+
193+ </details >
194+
177195### Quick note about submodules
178196
179197When updating your local repository with ` git pull ` , you may notice that sometimes
@@ -308,17 +326,16 @@ and rebase them:
308326```
309327git checkout master
310328git pull upstream master --ff-only # to make certain there are no merge commits
311- git checkout feature_branch
312- git rebase master
313- git push --force-with-lease (set origin to be the same as local)
329+ git rebase master feature_branch
330+ git push --force-with-lease # (set origin to be the same as local)
314331```
315332
316333To avoid merges as per the [ No-Merge Policy] ( #no-merge-policy ) , you may want to use
317334` git config pull.ff only ` (this will apply the config only to the local repo)
318335to ensure that Git doesn't create merge commits when ` git pull ` ing, without
319336needing to pass ` --ff-only ` or ` --rebase ` every time.
320337
321- You can also ` git push --force-with-lease ` from master to keep your origin 's master in sync with
338+ You can also ` git push --force-with-lease ` from master to keep your fork 's master in sync with
322339upstream.
323340
324341## Advanced Rebasing
0 commit comments