git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Allan Kelly <allankelly@gmail.com>
To: git@vger.kernel.org
Subject: sub-directory repo technique
Date: Fri, 12 Jun 2009 13:07:20 +0100	[thread overview]
Message-ID: <9586f3420906120507o194fc459l5fbdcd14a7095ae8@mail.gmail.com> (raw)

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.

             reply	other threads:[~2009-06-12 12:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-12 12:07 Allan Kelly [this message]
2009-06-16 16:50 ` sub-directory repo technique Avery Pennarun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9586f3420906120507o194fc459l5fbdcd14a7095ae8@mail.gmail.com \
    --to=allankelly@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).