* How to pull force just one folder in dev tree?
@ 2012-06-05 17:41 J.V.
2012-06-05 18:35 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: J.V. @ 2012-06-05 17:41 UTC (permalink / raw)
To: git
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 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)?
---
I want to git force pull from the branch I am on locally (tracked to a
branch on a remote bare repo) and force overwrite of all files locally &
also get the files I may have deleted locally from the file system (not
files deleted through git).
How do I practice this to see what would happen (or revert) your
solution if there are problems?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to pull force just one folder in dev tree?
2012-06-05 17:41 How to pull force just one folder in dev tree? J.V.
@ 2012-06-05 18:35 ` Junio C Hamano
2012-06-11 20:18 ` Philip Oakley
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2012-06-05 18:35 UTC (permalink / raw)
To: J.V.; +Cc: git
"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 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 -- .
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to pull force just one folder in dev tree?
2012-06-05 18:35 ` Junio C Hamano
@ 2012-06-11 20:18 ` Philip Oakley
0 siblings, 0 replies; 3+ messages in thread
From: Philip Oakley @ 2012-06-11 20:18 UTC (permalink / raw)
To: Junio C Hamano, J.V.; +Cc: Git List
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?
> "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.
>>
>> 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-06-11 20:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-05 17:41 How to pull force just one folder in dev tree? J.V.
2012-06-05 18:35 ` Junio C Hamano
2012-06-11 20:18 ` Philip Oakley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).