git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How to pull force just one folder in dev tree?

From
Philip Oakley <philipoakley@iee.org>
Date
Jun 11, 2012, 20:18 UTC
Message-ID
<8F71F33B20804F85AC15F77A30855D1C@PhilipOakley>
In-Reply-To
<7vlik1obdg.fsf@alter.siamese.dyndns.org>
From: "Junio C Hamano" <gitster@pobox.com>
To: "J.V." <jvsrvcs@gmail.com>
Cc: <git@vger.kernel.org>
Sent: Tuesday, June 05, 2012 7:35 PM
Subject: Re: How to pull force just one folder in dev tree?
Show 7 quoted lines
> "J.V." <jvsrvcs@gmail.com> writes:
>
>> If I am in my source code tree down deep in a directory at the
>> command
>> line, how do I pull from a repo and force overwrite all files locally
>> (and also get files that I deleted locally, just in the folder I am
>> in?)
I think the particular command for this case would be
    git checkout [-p|--patch] [<tree-ish>] [--] [<paths>.]
where the paths are defined as a pathspec (see git glossary for
details).

Though you should review how you got into this sticky situation and consider how you would adjust your workflow so you don't repeat the problem. e.g. creating a temporary branch earlier, with more commits or stashes.

Show 38 quoted lines
>>
>> I do not want to do this for the entire repo, just the directory that
>> I am in and also on the branch I am in.  I am not in the 'master'
>> branch, but another branch.
>>
>> so
>>
>>  $git reset --hard HEAD
>>
>>  Would probably do my entire local repo and from 'master' (even if I
>> am not on master)?
>
> No. It asks "Please reset the index and the working tree files to
> match what I have in the commit I checked out".  If you are on the
> 'slave' branch, the index and the working tree files are updated to
> match the commit at the tip of the 'slave' branch.
>
> It is unclear what you are trying to do, but if you made random
> changes in files in your current directory (somewhere deep), all
> changes are crap and you regret making them, and you are wishing to
> go back to the state you started from, then the way to ask "I want
> everything in this directory checked out from my current branch" is
> to say:
>
> $ git checkout HEAD -- .
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2012.0.2178 / Virus Database: 2433/5048 - Release Date:
> 06/05/12
>
Previous: Junio C Hamano
Message 3 of 3 in “How to pull force just one folder in dev tree?”
  1. J.V.Jun 5, 2012
  2. Junio C HamanoJun 5, 2012
  3. Philip OakleyJun 11, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.