Git Pull as Fetch Plus Integration

Pull obtains remote changes and then integrates according to the invocation and configuration. The two phases can have different outcomes.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace a divergence
  2. Inspect the result before acting again
  3. Separate observing an update from choosing history behavior
  4. Check local changes and configured behavior first

Trace a divergence

Suppose the local tip and fetched tip share an earlier parent and have independent commits. Fetch can succeed even if integration stops for conflicts or a fast-forward-only rule. See fetch and references.

Inspect the result before acting again

Review which tip was fetched and whether the current branch has changed. Use the commit graph to establish whether a merge occurred or integration still needs attention.[1]

Separate observing an update from choosing history behavior

Suppose local tip B and remote tip C both descend from A. Fetching supplies information about C. An integration strategy may merge B and C, rebase eligible local changes, or stop if only fast-forward is allowed. See fetch and remote-tracking references.

Base A with divergent children B and C
Fast-forward-only: stops
Merge-based integration: can create merge M
Rebase-based integration: can replay local B as B′ on C

Check local changes and configured behavior first

A plain pull's outcome depends on its options and configuration, especially when branches diverge. Compare the exact tips and review the result before publishing. Tests should exercise the combined behavior if integration resolves conflicts.

References

  1. Scott Chacon and Ben Straub, Pro Git ↩