Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6984a44

Browse files
committed
Add git command quick reference for git.md
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
1 parent 6b98218 commit 6984a44

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

‎src/git.md‎

Lines changed: 27 additions & 0 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /