Skip to content

Commit 0114bc2

Browse files
committed
Add git command quick reference for git.md
Signed-off-by: xizheyin <[email protected]>
1 parent f1127a9 commit 0114bc2

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/git.md

+27
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,33 @@ please [open an issue] so we can document how to fix it.
2525
[documentation]: https://docs.github.com/en/get-started/quickstart/set-up-git
2626
[guides]: https://guides.github.com/introduction/git-handbook/
2727

28+
## Quick Reference
29+
30+
Here are the most common Git commands you'll use when contributing to Rust:
31+
32+
- [Set up repository](#prerequisites)
33+
```sh
34+
# Setup: Add upstream remote to your fork
35+
git remote add upstream https://github.com/rust-lang/rust.git
36+
```
37+
- [Start new work, and Keep up to date with upstream](#keeping-things-up-to-date)
38+
```
39+
# Start new work
40+
git checkout master
41+
git pull upstream master --ff-only
42+
git checkout -b my-feature-branch
43+
```
44+
- [After resolving conflicts during rebase](#rebasing-and-conflicts)
45+
```
46+
git add <resolved-files>
47+
git rebase --continue
48+
git push --force-with-lease # Update your remote branch
49+
```
50+
- [Prevent creating merge commits (recommended)](#no-merge-policy)
51+
```
52+
git config pull.ff only
53+
```
54+
2855
## Prerequisites
2956

3057
We'll assume that you've installed Git, forked [rust-lang/rust], and cloned the

0 commit comments

Comments
 (0)