# FetchContent: incremental commit or full repo?

**URL:** https://discourse.cmake.org/t/fetchcontent-incremental-commit-or-full-repo/14405
**Category:** Usage
**Created:** [July 21, 2025, 6:01pm UTC](https://discourse.cmake.org/t/fetchcontent-incremental-commit-or-full-repo/14405 "2025-07-21T18:01:33Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![franki](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/f/71c47a/32.png) [@franki](https://discourse.cmake.org/u/franki)
#### Post date: [July 21, 2025, 6:01pm UTC](https://discourse.cmake.org/t/fetchcontent-incremental-commit-or-full-repo/14405/1 "2025-07-21T18:01:33Z")

</div>

I recently learned from discussions here that when FetchContent fetches a particular GIT\_TAG (i.e. a Git commit hash), it first pulls in the entire repo (from pointer to GIT\_REPOSITORY), then checks-out the requested GIT\_TAG. Okay.

But for an existing build directory into which FetchContent has previously pulled a repo, if the GIT\_TAG changes to refer to a commit not (yet) present in the build directory (i.e. \_reps/), does it fetch just the missing commit or the entire repo all over again?

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [July 21, 2025, 10:06pm UTC](https://discourse.cmake.org/t/fetchcontent-incremental-commit-or-full-repo/14405/2 "2025-07-21T22:06:32Z")

</div>

Going from memory, so I could be wrong, but I believe it just does a `git fetch` if there’s already a repo cloned but it doesn’t have the ref requested by `GIT_TAG`. It should end up just fetching the commits it doesn’t yet have.

You might be interested in the discussions on [issue 17770](https://gitlab.kitware.com/cmake/cmake/-/issues/17770). It isn’t directly related to your question, but it touches on areas that also relate to making clones and fetches faster.
