# why no "git fetch --dry-run" ?

4 messages from 2008-11-21 to 2008-11-22. Participants: Leo Razoumov, Miklos Vajna, Baz, Junio C Hamano.
Thread: https://gitlist.dev/t/16427

## Leo Razoumov, 2008-11-21 21:41

Subject: why no "git fetch --dry-run" ?
Message-ID: <ee2a733e0811211341j1e49fad7o64577605951fa5c0@mail.gmail.com>
URL: https://gitlist.dev/e/ee2a733e0811211341j1e49fad7o64577605951fa5c0%40mail.gmail.com

```
Hello List,
I am curious why there is "git push --dry-run" and no "git fetch
--dry-run" nor "git pull --dry-run". It would make sense to keep
push/pull/fetch as symmetric as possible.
For example, I just want to see which branches, if any, changed on a
remote repository since my last fetch. "git fetch -v --dry-run" would
be handy in this case.

--Leo--

```

## Miklos Vajna, 2008-11-21 22:18

Subject: Re: why no "git fetch --dry-run" ?
Message-ID: <20081121221826.GM21815@genesis.frugalware.org>
URL: https://gitlist.dev/e/20081121221826.GM21815%40genesis.frugalware.org
In-Reply-To: <ee2a733e0811211341j1e49fad7o64577605951fa5c0@mail.gmail.com>

```
On Fri, Nov 21, 2008 at 04:41:57PM -0500, Leo Razoumov <slonik.az@gmail.com> wrote:
> I am curious why there is "git push --dry-run" and no "git fetch
> --dry-run" nor "git pull --dry-run". It would make sense to keep
> push/pull/fetch as symmetric as possible.
> For example, I just want to see which branches, if any, changed on a
> remote repository since my last fetch. "git fetch -v --dry-run" would
> be handy in this case.

Actually fetch - at a core level - isn't symmetric to push, the protocol
is completely different. I haven't checked the source, but I suppose
that the push protocol has "dry run" support, while the fetch one
doesn't have.

```

## Baz, 2008-11-21 23:14

Subject: Re: why no "git fetch --dry-run" ?
Message-ID: <2faad3050811211514u1f3eb3deg7ae597a0328c981c@mail.gmail.com>
URL: https://gitlist.dev/e/2faad3050811211514u1f3eb3deg7ae597a0328c981c%40mail.gmail.com
In-Reply-To: <20081121221826.GM21815@genesis.frugalware.org>

```
2008/11/21 Miklos Vajna <vmiklos@frugalware.org>:
> On Fri, Nov 21, 2008 at 04:41:57PM -0500, Leo Razoumov <slonik.az@gmail.com> wrote:
>> I am curious why there is "git push --dry-run" and no "git fetch
>> --dry-run" nor "git pull --dry-run". It would make sense to keep
>> push/pull/fetch as symmetric as possible.
>> For example, I just want to see which branches, if any, changed on a
>> remote repository since my last fetch. "git fetch -v --dry-run" would
>> be handy in this case.
>
> Actually fetch - at a core level - isn't symmetric to push, the protocol
> is completely different. I haven't checked the source, but I suppose
> that the push protocol has "dry run" support, while the fetch one
> doesn't have.
>

I wrote the patch for "push --dry-run" because I was more worried
about messing up the central repository (which I can't fix) than
messing up my local repository (which I can). It just needed a few
checks added to send-pack to make it work. I guess it's not been done
for fetch yet because nobody had that itch, shouldn't be too hard to
write. Certainly, other people have asked for it.

-Baz

```

## Junio C Hamano, 2008-11-22 00:40

Subject: Re: why no "git fetch --dry-run" ?
Message-ID: <7vtza0pp8y.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vtza0pp8y.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <ee2a733e0811211341j1e49fad7o64577605951fa5c0@mail.gmail.com>

```
"Leo Razoumov" <slonik.az@gmail.com> writes:

> I am curious why there is "git push --dry-run" and no "git fetch
> --dry-run" nor "git pull --dry-run". It would make sense to keep
> push/pull/fetch as symmetric as possible.

There are things that are not implemented in git because they do not make
sense, and there are things that are not implemented in git because nobody
had itch to scratch for.  To put it differently, we tend to implement only
things that there are actual, demonstrated needs for from real world and
only when the addition makes sense as a coherent part of the system.

"fetch --dry-run" falls into the latter category.

"push" is hard to undo because it affects the outside world, but "fetch"
is only about your local object store and its remote tracking branches, so
the need to have --dry-run mode to "push" was much more real than to the
need for "fetch --dry-run" and was implemented.

If you have the itch for the latter, I do not think anybody objects to it
on the ground that such a feature does not make sense.

Having said that, "fetch --dry-run" probably has little value in practice.
You cannot tell how much data will be transferred before actually running
a fetch, so it won't be a tool for you to decide if you can afford the
time to run fetch now or do that later ("push --dry-run" will let you gain
the necessary information for doing this this if your push is
fast-forward, which should mostly be the case).  The only information you
would get is if an actual "fetch" will have any update to each of the
branches you are tracking (so that's one bit per branch) and if you have a
connection to the other end, and that is about it.

```
