← Git: team decisions and recovery
03 / 5 · 18 MIN

Remotes and coordinated publication

Distinguish obtaining history, integrating it, and publishing references.

Concept and mechanism

A remote identifies a repository and configures fetching or sending references. Fetch obtains objects and updates configured references, allowing inspection before integration. Pull combines fetching with integration according to options and configuration. Push asks the server to update references. A non-fast-forward rejection may protect remote commits absent from your local history. It should not be treated as a simple network error. Server authorization and protection rules still constrain publication.

Guided application

In an exercise with two local clones, make a commit in each from the same base. Publish the first and observe the second rejection. In the second clone, fetch remote history, inspect divergence, and integrate under team policy before publishing again. If rewriting is authorized, understand the expectation protected by force-with-lease. A lease does not prove your commits contain all required work, and background updates to local references can change protection assumptions.

IN PRACTICE

A hotfix reaches the remote while you work. The rejected push prevents accidentally ignoring it. Compare the commits and preserve both objectives during integration.

Common pitfalls

Confusing fetch with automatically changing current-branch files; using force to bypass unanalyzed divergence.

Related topics: Reverse changes and preserve work · Diagnosis and release traceability

Take this idea with you

A rejection can protect work; inspect divergence before publishing.

Create account

Reference: Git: fetching remote objects · Git 2.56; workflow concepts compatible with modern Git 2.x