Skip to content

Commit a916fa1

Browse files
committed
configuring git
Signed-off-by: sliptonic <[email protected]>
1 parent 6e36292 commit a916fa1

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

maintainersguide/git.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
layout: default
3+
---
4+
5+
# Git and Github
6+
7+
## Checking out PRs locally for review
8+
9+
Git can [checkout pull requests from a remote repository](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally). This makes it easier to review pull requests locally, and to run tests against them.
10+
11+
## Configuring Git to make checkout easier.
12+
13+
You can modify your .gitconfig file to include the PR namespace. This allows easier checkout of PRs and also
14+
shows the PRs in graphical tools like gitk.
15+
16+
### edit the .git/config file
17+
18+
Make sure that you have a remote defined in your .git/config file that corresponds to the main FreeCAD repo.
19+
Ideally, this remote is named "upstream". If you don't have this remote defined, you can add it like this:
20+
21+
```bash
22+
[remote "upstream"]
23+
url = [email protected]:FreeCAD/FreeCAD.git
24+
fetch = +refs/heads/*:refs/remotes/upstream/*
25+
```
26+
27+
### add the PR namespace
28+
add a second fetch line to the upstream remote definition. This line will fetch the PR namespace from the upstream repo.
29+
```
30+
fetch = +refs/pull/*/head:refs/remotes/upstream/pr/*
31+
```
32+
33+
### now you can fetch PRs with the command
34+
```bash
35+
git fetch upstream
36+
```
37+
38+
### checkout a PR
39+
```bash
40+
git checkout upstream/pr/1234
41+
```
42+
43+
44+
45+

maintainersguide/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ layout: default
44

55
# Maintainers Guide
66

7-
Guidelines for Maintainers regarding code review and merge procedures.
7+
Guidelines for Maintainers regarding code review and merge procedures. Git can be [configured to make checking out and reviewing PRs easier](./git.md).
88

99

1010
## The Role of a Maintainer

0 commit comments

Comments
 (0)