You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Ensure that you're making your changes on top of master:
59
63
`git checkout master`.
60
64
2. Get the latest changes from the Rust repo: `git pull upstream master --ff-only`.
61
-
(see [No-Merge Policy](#keeping-things-up-to-date) for more info about this).
65
+
(see [No-Merge Policy][no-merge-policy] for more info about this).
62
66
3. Make a new branch for your change: `git checkout -b issue-12345-fix`.
63
67
4. Make some changes to the repo and test them.
64
68
5. Stage your changes via `git add src/changed/file.rs src/another/change.rs`
@@ -76,7 +80,7 @@ pulling-and-rebasing, you can use `git push --force-with-lease`).
76
80
77
81
If you end up needing to rebase and are hitting conflicts, see [Rebasing](#rebasing).
78
82
If you want to track upstream while working on long-running feature/issue, see
79
-
[Keeping things up to date](#keeping-things-up-to-date).
83
+
[Keeping things up to date][no-merge-policy].
80
84
81
85
If your reviewer requests changes, the procedure for those changes looks much
82
86
the same, with some steps skipped:
@@ -86,13 +90,22 @@ the same, with some steps skipped:
86
90
2. Make, stage, and commit your additional changes just like before.
87
91
3. Push those changes to your fork: `git push`.
88
92
93
+
[no-merge-policy]: #keeping-things-up-to-date
94
+
89
95
## Troubleshooting git issues
90
96
91
97
You don't need to clone `rust-lang/rust` from scratch if it's out of date!
92
98
Even if you think you've messed it up beyond repair, there are ways to fix
93
99
the git state that don't require downloading the whole repository again.
94
100
Here are some common issues you might run into:
95
101
102
+
### I made a merge commit by accident.
103
+
104
+
Git has two ways to update your branch with the newest changes: merging and rebasing.
105
+
Rust [uses rebasing][no-merge-policy]. If you make a merge commit, it's not too hard to fix: `git rebase -i origin/master`.
106
+
107
+
See [Rebasing][#rebasing] for more about rebasing.
108
+
96
109
### I deleted my fork on GitHub!
97
110
98
111
This is not a problem from git's perspective. If you run `git remote -v`,
@@ -114,6 +127,28 @@ git remote set-url personal <URL>
114
127
115
128
where the `<URL>` is your new fork.
116
129
130
+
### I see "error: cannot rebase" when I try to rebase
131
+
132
+
These are two common errors to see when rebasing:
133
+
```
134
+
error: cannot rebase: Your index contains uncommitted changes.
135
+
error: Please commit or stash them.
136
+
```
137
+
```
138
+
error: cannot rebase: You have unstaged changes.
139
+
error: Please commit or stash them.
140
+
```
141
+
142
+
(See https://git-scm.com/book/en/v2/Getting-Started-What-is-Git%3F#_the_three_states for the difference between the two.)
143
+
144
+
This means you have made changes since the last time you made a commit. To be able to rebase, either commit your changes, or make a temporary commit called a "stash" to have them still not be commited when you finish rebasing. You may want to configure git to make this "stash" automatically, which will prevent the "cannot rebase" error in nearly all cases:
145
+
146
+
```
147
+
git config --global rebase.autostash true
148
+
```
149
+
150
+
See https://git-scm.com/book/en/v2/Git-Tools-Stashing-and-Cleaning for more info about stashing.
151
+
117
152
### I see 'Untracked Files: src/stdarch'?
118
153
119
154
This is left over from the move to the `library/` directory.
0 commit comments