Skip to content

Commit fa94fd5

Browse files
author
MarcoFalke
committed
doc: Explain how to fetch commits directly
1 parent 5e6dbfd commit fa94fd5

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

doc/productivity.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Table of Contents
1919
* [More conflict context with `merge.conflictstyle diff3`](#more-conflict-context-with-mergeconflictstyle-diff3)
2020
* [Reviewing code](#reviewing-code)
2121
* [Reduce mental load with `git diff` options](#reduce-mental-load-with-git-diff-options)
22+
* [Fetch commits directly](#fetch-commits-directly)
2223
* [Reference PRs easily with `refspec`s](#reference-prs-easily-with-refspecs)
2324
* [Diff the diffs with `git range-diff`](#diff-the-diffs-with-git-range-diff)
2425

@@ -164,9 +165,17 @@ When reviewing patches that change symbol names in many places, use `git diff --
164165

165166
When reviewing patches that move code around, try using `git diff --patience commit~:old/file.cpp commit:new/file/name.cpp`, and ignoring everything except the moved body of code which should show up as neither `+` or `-` lines. In case it was not a pure move, this may even work when combined with the `-w` or `--word-diff` options described above. `--color-moved=dimmed-zebra` will also dim the coloring of moved hunks in the diff on compatible terminals.
166167

168+
### Fetch commits directly
169+
170+
Before inspecting any remotely created commit locally, it has to be fetched.
171+
This is possible via `git fetch origin <full_commit_hash>`. Even commits not
172+
part of any branch or tag can be fetched as long as the remote has not garbage
173+
collected them.
174+
175+
167176
### Reference PRs easily with `refspec`s
168177

169-
When looking at other's pull requests, it may make sense to add the following section to your `.git/config` file:
178+
As an alternative to fetching commits directly, when looking at pull requests by others, it may make sense to add the following section to your `.git/config` file:
170179

171180
```
172181
[remote "upstream-pull"]

0 commit comments

Comments
 (0)