Skip to content

Commit e18322e

Browse files
committed
Merge bitcoin/bitcoin#32774: doc: Explain how to fetch commits directly
fa94fd5 doc: Explain how to fetch commits directly (MarcoFalke) Pull request description: This is often needed, and works better than the existing refspec documentation, because even commits that have been force-pushed away can be fetched (as long as they are not garbage collected on the remote). ACKs for top commit: Sjors: ACK fa94fd5 l0rinc: ACK fa94fd5 willcl-ark: ACK fa94fd5 rkrux: ACK fa94fd5 janb84: ACK fa94fd5 Tree-SHA512: b68c0c612e13f501ad4c1c709502e060b0a2d0eb55ef888c7466e2a10bdf3ca63d81b8bd7927de49cde9e29f0b06f8233d51b99d015ae0b39d556854be542b8a
2 parents b861419 + fa94fd5 commit e18322e

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)