# Push from specific directory.

11 messages from 2012-03-22 to 2012-03-26. Participants: Anjib Mulepati, Jeff King, Neal Kreitzinger, Junio C Hamano, Holger Hellmuth.
Thread: https://gitlist.dev/t/30031

## Anjib Mulepati, 2012-03-22 22:04

Subject: Push from specific directory.
Message-ID: <BLU0-SMTP471329E4F80CD64A569A4F7B1410@phx.gbl>
URL: https://gitlist.dev/e/BLU0-SMTP471329E4F80CD64A569A4F7B1410%40phx.gbl

```
Hi All

I am starting using Git and few queries about it.
1. Is it always necessary to be in root directory to do the push?
2. Can I have a folder structure like
         (a) /Hello-World
         (b) /Hello-World/gitVersion/GitVersionFile.txt and
         (c) /Hello-World/nonGitVersion/NonGitVersionFile.txt
where I give git init for (a) and (c). If Itry to push only from (c) is 
that valid?

Thanks,
Anjib

```

## Jeff King, 2012-03-22 22:57

Subject: Re: Push from specific directory.
Message-ID: <20120322225747.GB14874@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20120322225747.GB14874%40sigill.intra.peff.net
In-Reply-To: <BLU0-SMTP471329E4F80CD64A569A4F7B1410@phx.gbl>

```
On Thu, Mar 22, 2012 at 06:04:20PM -0400, Anjib Mulepati wrote:

> 1. Is it always necessary to be in root directory to do the push?

No. You are pushing whole commits, not a particular subset of your
working tree. So doing it from anywhere in the repository should have
the same effect.

But...

> 2. Can I have a folder structure like
>         (a) /Hello-World
>         (b) /Hello-World/gitVersion/GitVersionFile.txt and
>         (c) /Hello-World/nonGitVersion/NonGitVersionFile.txt
> where I give git init for (a) and (c). If Itry to push only from (c)
> is that valid?

You have a repository inside a repository. So when you are in (c), you
will be pushing the commits from (c), not from (a). I'm not really sure
what you are trying to accomplish with that.

-Peff

```

## Neal Kreitzinger, 2012-03-22 23:22

Subject: Re: Push from specific directory.
Message-ID: <4F6BB425.2010807@gmail.com>
URL: https://gitlist.dev/e/4F6BB425.2010807%40gmail.com
In-Reply-To: <20120322225747.GB14874@sigill.intra.peff.net>

```
On 3/22/2012 5:57 PM, Jeff King wrote:
> On Thu, Mar 22, 2012 at 06:04:20PM -0400, Anjib Mulepati wrote:
>
>> 2. Can I have a folder structure like (a) /Hello-World (b)
>> /Hello-World/gitVersion/GitVersionFile.txt and (c)
>> /Hello-World/nonGitVersion/NonGitVersionFile.txt where I give git
>> init for (a) and (c). If Itry to push only from (c) is that valid?
>
> You have a repository inside a repository. So when you are in (c),
> you will be pushing the commits from (c), not from (a). I'm not
> really sure what you are trying to accomplish with that.
>
See this thread for the "cons" of nested git repos: (I don't think there 
are any "pros".)
http://thread.gmane.org/gmane.comp.version-control.git/190372

*If* that is really what you meant...

v/r,
neal

```

## Jeff King, 2012-03-22 23:27

Subject: Re: Push from specific directory.
Message-ID: <20120322232723.GA15676@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20120322232723.GA15676%40sigill.intra.peff.net
In-Reply-To: <4F6BB425.2010807@gmail.com>

```
On Thu, Mar 22, 2012 at 06:22:13PM -0500, Neal Kreitzinger wrote:

> >You have a repository inside a repository. So when you are in (c),
> >you will be pushing the commits from (c), not from (a). I'm not
> >really sure what you are trying to accomplish with that.
> >
> See this thread for the "cons" of nested git repos: (I don't think
> there are any "pros".)
> http://thread.gmane.org/gmane.comp.version-control.git/190372

Nested git repos are OK. I use one inside my git.git checkout to hold
meta-information and scripts (and I know Junio does the same thing). But
I mark the sub-repository as ignored in the parent repository.  What's
insane is trying to track the same set of files from two different
repositories. And I think that is the confusing case in the thread you
mentioned.

-Peff

```

## Junio C Hamano, 2012-03-22 23:53

Subject: Re: Push from specific directory.
Message-ID: <7vlimsur95.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vlimsur95.fsf%40alter.siamese.dyndns.org
In-Reply-To: <4F6BB425.2010807@gmail.com>

```
Neal Kreitzinger <nkreitzinger@gmail.com> writes:

> See this thread for the "cons" of nested git repos: (I don't think
> there are any "pros".)
> http://thread.gmane.org/gmane.comp.version-control.git/190372

Hmph, I see you saying "I will keep this in mind" and "Thanks" at the end,
and back then I took it that you understood why/how nested working trees
are useful.  Perhaps you didn't and I misunderstood you?

```

## Neal Kreitzinger, 2012-03-22 23:56

Subject: Re: Push from specific directory.
Message-ID: <4F6BBC2D.10204@gmail.com>
URL: https://gitlist.dev/e/4F6BBC2D.10204%40gmail.com
In-Reply-To: <20120322232723.GA15676@sigill.intra.peff.net>

```
On 3/22/2012 6:27 PM, Jeff King wrote:
> On Thu, Mar 22, 2012 at 06:22:13PM -0500, Neal Kreitzinger wrote:
>
>>> You have a repository inside a repository. So when you are in (c),
>>> you will be pushing the commits from (c), not from (a). I'm not
>>> really sure what you are trying to accomplish with that.
>>>
>> See this thread for the "cons" of nested git repos: (I don't think
>> there are any "pros".)
>> http://thread.gmane.org/gmane.comp.version-control.git/190372
>
> Nested git repos are OK. I use one inside my git.git checkout to hold
> meta-information and scripts (and I know Junio does the same thing). But
> I mark the sub-repository as ignored in the parent repository.  What's
> insane is trying to track the same set of files from two different
> repositories. And I think that is the confusing case in the thread you
> mentioned.
>
Yes, hopefully the nested git repo is ignored by the higher level git
repo.  However, if it was ignored I don't suspect one would be wondering
if it was ok to "only" push from the nested repo.  I could be wrong.

v/r,
neal

```

## Neal Kreitzinger, 2012-03-23 00:09

Subject: Re: Push from specific directory.
Message-ID: <4F6BBF4F.9080302@gmail.com>
URL: https://gitlist.dev/e/4F6BBF4F.9080302%40gmail.com
In-Reply-To: <7vlimsur95.fsf@alter.siamese.dyndns.org>

```
On 3/22/2012 6:53 PM, Junio C Hamano wrote:
> Neal Kreitzinger<nkreitzinger@gmail.com>  writes:
>
>> See this thread for the "cons" of nested git repos: (I don't think
>> there are any "pros".)
>> http://thread.gmane.org/gmane.comp.version-control.git/190372
>
> Hmph, I see you saying "I will keep this in mind" and "Thanks" at the end,
> and back then I took it that you understood why/how nested working trees
> are useful.  Perhaps you didn't and I misunderstood you?

I neglected to distinguish between ignored-nested-git-repos (has pros) 
and tracked-subdir-nested-git-repos (has no pros) in my preface to the 
thread link.  That was an oversight on my part.

BTW, I'm am still being compelled to deal with 
tracked-subdir-nested-git-repos and I have not found any pros to them so 
your original assessment of that technique still stands. ;-)

v/r,
neal

```

## Neal Kreitzinger, 2012-03-23 01:29

Subject: Re: Push from specific directory.
Message-ID: <4F6BD1E2.2050607@gmail.com>
URL: https://gitlist.dev/e/4F6BD1E2.2050607%40gmail.com
In-Reply-To: <20120322225747.GB14874@sigill.intra.peff.net>

```
On 3/22/2012 5:57 PM, Jeff King wrote:
> On Thu, Mar 22, 2012 at 06:04:20PM -0400, Anjib Mulepati wrote:
>
>> 2. Can I have a folder structure like (a) /Hello-World (b)
>> /Hello-World/gitVersion/GitVersionFile.txt and (c)
>> /Hello-World/nonGitVersion/NonGitVersionFile.txt where I give git
>> init for (a) and (c). If Itry to push only from (c) is that valid?
>
> You have a repository inside a repository. So when you are in (c),
> you will be pushing the commits from (c), not from (a). I'm not
> really sure what you are trying to accomplish with that.
>
It almost looks like he might be tracking his git installation with git
by tracking the "gitVersion" dir, and the "NonGitVersion" dir is really 
the "normal" git repo containing a dev project.  I'm probably making a 
misinterpretation of the wording and "gitVersion" means "stuff versioned 
by git", but then again "NonGitVersion" is also supposedly being 
versioned by git.  Just curious if he's attempting to use his git 
installation to track itself which would be interesting also.

v/r,
neal

```

## Neal Kreitzinger, 2012-03-23 15:30

Subject: Re: Push from specific directory.
Message-ID: <4F6C970B.2010803@gmail.com>
URL: https://gitlist.dev/e/4F6C970B.2010803%40gmail.com
In-Reply-To: <BLU0-SMTP315865C5026D08E76594E5DB1460@phx.gbl>

```
On 3/23/2012 8:35 AM, Anjib Mulepati wrote:
> I  am comparing Git with other SVN.
>
> In SVN each folders have .svn folder. If we don't wanna track 
> particular folder then there is no .svn folder in that directory. In 
> Git does we have same structure?
>
> So the example I am giving here represent two versions and one 
> non-version folder.
>
There is only one .git dir per git repo.  By default it is created under 
the top-level dir (worktree) of the repo.  If you don't want to track a 
subdir then you ignore it using the gitignore technology of git.  You 
would want to setup the gitignore before doing the init.

v/r,
neal

```

## Holger Hellmuth, 2012-03-26 14:27

Subject: Re: Push from specific directory.
Message-ID: <4F707CB4.3030308@ira.uka.de>
URL: https://gitlist.dev/e/4F707CB4.3030308%40ira.uka.de
In-Reply-To: <4F6C970B.2010803@gmail.com>

```
On 23.03.2012 16:30, Neal Kreitzinger wrote:

> You would want to setup the gitignore before doing the init.

Why that? "git init" doesn't add any files, the repo is still empty.

I would even say "git init" helps because you get a comprehensive list 
of non-ignored files with "git status" and can sift through that list 
for files you want to be ignored

```

## Neal Kreitzinger, 2012-03-26 14:41

Subject: Re: Push from specific directory.
Message-ID: <4F70802F.4020603@gmail.com>
URL: https://gitlist.dev/e/4F70802F.4020603%40gmail.com
In-Reply-To: <4F707CB4.3030308@ira.uka.de>

```
On 3/26/2012 9:27 AM, Holger Hellmuth wrote:
> On 23.03.2012 16:30, Neal Kreitzinger wrote:
>
>> You would want to setup the gitignore before doing the init.
>
> Why that? "git init" doesn't add any files, the repo is still empty.
>
> I would even say "git init" helps because you get a comprehensive list 
> of non-ignored files with "git status" and can sift through that list 
> for files you want to be ignored
>
>
Thanks for correcting that.

v/r,
neal

```
