Push from specific directory.

6 messages, 3 authors, 2016-06-15 · open the first message on its own page

Push from specific directory.

From: Anjib Mulepati <hidden>
Date: 2016-06-15 22:53:22

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

Re: Push from specific directory.

From: Jeff King <hidden>
Date: 2016-06-15 22:53:22

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

Re: Push from specific directory.

From: Neal Kreitzinger <hidden>
Date: 2016-06-15 22:53:22

On 3/22/2012 5:57 PM, Jeff King wrote:
On Thu, Mar 22, 2012 at 06:04:20PM -0400, Anjib Mulepati wrote:
quoted
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

Re: Push from specific directory.

From: Jeff King <hidden>
Date: 2016-06-15 22:53:22

On Thu, Mar 22, 2012 at 06:22:13PM -0500, Neal Kreitzinger wrote:
quoted
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

Re: Push from specific directory.

From: Neal Kreitzinger <hidden>
Date: 2016-06-15 22:53:22

On 3/22/2012 6:27 PM, Jeff King wrote:
On Thu, Mar 22, 2012 at 06:22:13PM -0500, Neal Kreitzinger wrote:
quoted
quoted
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

Re: Push from specific directory.

From: Neal Kreitzinger <hidden>
Date: 2016-06-15 22:53:22

On 3/22/2012 5:57 PM, Jeff King wrote:
On Thu, Mar 22, 2012 at 06:04:20PM -0400, Anjib Mulepati wrote:
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help