From: Jonathan Tan Date: Mon, 19 Jun 2017 17:49:36 GMT Subject: Re: Behavior of 'git fetch' for commit hashes Message-ID: <20170619104936.706eff69@twelve2.svl.corp.google.com> In-Reply-To: <14e804c6-0798-8bbd-b182-66c3cd2b870c@vaisala.com> On Mon, 19 Jun 2017 12:09:28 +0000 wrote: > For version 2.7.4 > ================= > Git exits with exit code 1. > > However, if I first do 'git fetch ', then 'git fetch will > also work > > * branch -> FETCH_HEAD I suspect that what is happening is that 'git fetch ' also downloads the commit referenced by , so the subsequent 'git fetch ' is a no-op (except setting FETCH_HEAD). > For version 2.13.3 > ================== > Git exits with exit code 128 and message > fatal: Couldn't find remote ref > > However, the workaround for descbibed abot for git version 2.7.4 no > longer works. The result is always > fatal: Couldn't find remote ref I'll take a look into this. > Desired result > ============== > Commit is in .git/FETCH_HEAD and can be checked out. > > > I want to checkout a specific commit without creating any extra named > remotes in the local git clone. > > Finally, > What is the expected behavior for 'git fetch' in this case? > Is there some other way I can achieve my goals? I'll take a look into the expected behavior, but if my assumptions are correct, you should be able to just checkout the commit you want after fetching the branch: git fetch git checkout