sub-directory repo technique

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]