All of lore.kernel.org
 help / color / mirror / Atom feed
* sub-directory repo technique
@ 2009-06-12 12:07 Allan Kelly
  2009-06-16 16:50 ` Avery Pennarun
  0 siblings, 1 reply; 2+ messages in thread
From: Allan Kelly @ 2009-06-12 12:07 UTC (permalink / raw)
  To: git

Hi,

I'm quite new to git, but it is serving me well.  The main scenario I
am working with is my own code bases with several centralised repos on
a server. I clone, develop and push from a various machines, rather
than working on the server. Great!

However, for one of my projects I have the following:

* xidebar repo contains perl programs & modules, and a projects/ directory
* Under projects/ are self-contained project trees, eg
projects/westbarnsgala.info
* The total size is quite large and it's undesirable to clone the
whole thing remotely
* I want to be able to remote clone, edit, and push just a specific
projects/westbarnsgala.info tree

I have a solution which works fine for me below. I wonder if this is
recommended however, or whether there's "another way to do it"?
Probably!

With xidebar as the 'parent' repo on the "rss_rand" server for
tracking all xidebar contant together, I then go into the individual
project/proj1 dirs and create a repo there. I can then remotely clone
this repo, edit and push as below.

Here's the blow-by-blow description.

(I need the top-level .gitignore to contain a line '.gitignore' to
avoid reporting the "sub-repo" .gitignore as untracked - which is
correct but not of interest. It appears that git automatically ignores
the .git dir for the westbarnsgala.info repo created below)

On rss_rand server:
With previously created xidebar/ repo:
* add line '.gitignore' in xidebar/.gitignore
1. Create westbarnsgala.info repo
* cd projects/westbarnsgala.info
* git init
* git add .
* git commit -a -m 'initial commit'
2. On other machine: Clone, edit, commit locally and push changes remotely
* cd projects
* git clone rss_rand:~/xidebar/projects/westbarnsgala.info/ wbg
* cd wbg
* vi htmlgen.xml
* commit -a -m 'a smalll update'
* git push origin
3. On rss_rand: Update local files with remote changes from local repo
* => The git repo is up to date with the remote edit.
* => The files are not.
* => A checkout reports the mis-match and bails.
* => So force it.
* git checkout -f
* => Now the files are up to date!
Now 'git status' on either machine shows things are up to date.
4. Now, back to the rss_rand xidebar repo: commit changes.
* cd ../..
* git status => Shows changes detected correctly
* git commit -a -m 'update to westbarnsgala.info'

Routine of work is now:
Edit on laptop.
* => If in doubt, start with a 'git pull' (Which does both fetch and merge).
* commit -a -m 'a message'
* git push
Publish from rss_rand (overnight cron script):
* cd xidebar/projects/westbarnsgala.info
* git status => Just to check
* git checkout -f
* cd ../..
* ./xidebar westbarnsgala.info && ftp_dir_diff westbarnsgala.info


Cheers, al.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: sub-directory repo technique
  2009-06-12 12:07 sub-directory repo technique Allan Kelly
@ 2009-06-16 16:50 ` Avery Pennarun
  0 siblings, 0 replies; 2+ messages in thread
From: Avery Pennarun @ 2009-06-16 16:50 UTC (permalink / raw)
  To: Allan Kelly; +Cc: git

On Fri, Jun 12, 2009 at 8:07 AM, Allan Kelly<allankelly@gmail.com> wrote:
> (I need the top-level .gitignore to contain a line '.gitignore' to
> avoid reporting the "sub-repo" .gitignore as untracked - which is
> correct but not of interest. It appears that git automatically ignores
> the .git dir for the westbarnsgala.info repo created below)

It's not really "ignoring" the .git dir.  It's treating the entire
subtree that contains the .git dir as a submodule.  See 'man
git-submodule'.  Git submodules may actually resolve your problem in a
more straightforward way than what you're doing.

You might also be interested in my git-subtree tool:
http://github.com/apenwarr/git-subtree

Have fun,

Avery

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-06-16 16:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-12 12:07 sub-directory repo technique Allan Kelly
2009-06-16 16:50 ` Avery Pennarun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.