I have a sub-application project that I had previously converted to edge
rails under svn. Originally, vendor/rails was set up with svn:externals
so that an svn update at the project’s root would pull the latest trunk
along with all the other updates. Since Rails has moved to GiT and
depreciated svn I decided to remove the svn:externals reference for
vendor/rails and reinstall trunk using ‘git clone
git://github.com/rails/rails.git’.
The question that I have is: what git command does on use to check
for/retrieve updates to trunk? Does one simply reissue the git clone
command? Is there a simple way (from the command line) to check for
updates without pulling them?
The question that I have is: what git command does on use to check
for/retrieve updates to trunk? Does one simply reissue the git clone
command? Is there a simple way (from the command line) to check for
updates without pulling them?
After you’ve cloned the repos, you can use “git pull” to get the
latest updates.
DHH wrote:
The question that I have is: what git command does on use to check
for/retrieve updates to trunk? �Does one simply reissue the git clone
command? �Is there a simple way (from the command line) to check for
updates without pulling them?
After you’ve cloned the repos, you can use “git pull” to get the
latest updates.
Is there a way to run git pull from the project root directory? The
example given above works provided that I cd to the vendor/rails
directory first. However, if I try this from the project root:
git --work-tree=vendor/rails pull
or this
git --git-dir=vendor/rails pull
then I get this error:
fatal: Not a git repository
Failed to find a valid git directory.
On a whim I even tried this:
git pull vendor/rails/.git
but that worked no better than the first two attempts.
I regret if these questions appear naive but I cannot find an answer to
them in the documentation, or if answers are there then I do not
apprehend them.
Patrick A. wrote:
You can do something like:
git submodule add vendor/rails
git submodule init
git submodule update
Do I have to initialize a git repository in the project root first? If
I just follow these instructions then I see this:
fatal: Not a git repository: ‘.git’
You need to run this command from the toplevel of the working tree.
James B. wrote:
Patrick A. wrote:
You can do something like:
git submodule add vendor/rails
git submodule init
git submodule update
Do I have to initialize a git repository in the project root first? If
I just follow these instructions then I see this:
fatal: Not a git repository: ‘.git’
You need to run this command from the toplevel of the working tree.
Yes, I need to run git init in the root directory first.
You can do something like:
git submodule add vendor/rails
git submodule init
git submodule update
James B. wrote:
James B. wrote:
Patrick A. wrote:
You can do something like:
git submodule add vendor/rails
git submodule init
git submodule update
Do I have to initialize a git repository in the project root first? If
I just follow these instructions then I see this:
fatal: Not a git repository: ‘.git’
You need to run this command from the toplevel of the working tree.
Yes, I need to run git init in the root directory first.
However, I do not know if this is a bug in GiT or a misunderstanding I
have but:
If I run git submodule update in the project root then git pulls a clone
and puts it in a new rails directory immediately under the project root:
[proforma]$ git --version
git version 1.5.3.6
[proforma]$ git-config --list
user.name=James B. Byrne
[email protected]
color.diff=auto
color.status=auto
color.branch=auto
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
submodule.rails.url=/home/byrnejb/Software/Development/Projects/proforma/vendor/rails/.git
[proforma]$
[proforma]$ ll rails
ls: rails: No such file or directory
[proforma]$
[proforma]$ git submodule update
Initialized empty Git repository in
/home/byrnejb/projects/proforma/rails/.git/
0 blocks
Submodule path ‘rails’: checked out
‘642bcd2d011ce8c32a0a69bfb4fd6942593584bb’
[proforma]$
[proforma]$ ll rails
total 88
drwxrwxr-x 4 byrnejb byrnejb 4096 Apr 29 13:11 actionmailer
drwxrwxr-x 4 byrnejb byrnejb 4096 Apr 29 13:11 actionpack
drwxrwxr-x 4 byrnejb byrnejb 4096 Apr 29 13:11 activemodel
drwxrwxr-x 5 byrnejb byrnejb 4096 Apr 29 13:11 activerecord
drwxrwxr-x 4 byrnejb byrnejb 4096 Apr 29 13:11 activeresource
drwxrwxr-x 4 byrnejb byrnejb 4096 Apr 29 13:11 activesupport
-rwxrwxr-x 1 byrnejb byrnejb 105 Apr 29 13:11 cleanlogs.sh
-rwxrwxr-x 1 byrnejb byrnejb 484 Apr 29 13:11 pushgems.rb
drwxrwxr-x 12 byrnejb byrnejb 4096 Apr 29 13:11 railties
-rw-rw-r-- 1 byrnejb byrnejb 559 Apr 29 13:11 Rakefile
-rwxrwxr-x 1 byrnejb byrnejb 775 Apr 29 13:11 release.rb
It appears as if I must issue “git submodule update vendor/rails” for
this to work the way I desire. Is there something that I should be
doing differently?
On Tue, Apr 29, 2008 at 12:24 PM, James B.
[email protected] wrote:
James B. wrote:
James B. wrote:
Patrick A. wrote:
You can do something like:
git submodule add vendor/rails
git submodule init
git submodule update
then do this:
rm -rf vendor/Rails
git submodule add git://github.com/rails/rails.git vendor/
git submodule init
git submodule update
oops, that should be:
rm -rf vendor/rails
git submodule add git://github.com/rails/rails.git vendor/rails
git submodule init
git submodule update
Patrick A. wrote:
oops, that should be:
rm -rf vendor/rails
git submodule add git://github.com/rails/rails.git vendor/rails
git submodule init
git submodule update
That seems to have done the trick.
Thank you very much.
Patrick A. wrote:
then do this:
rm -rf vendor/Rails
git submodule add git://github.com/rails/rails.git vendor/
git submodule init
git submodule update
$ cd projects/proforma
[proforma]$ git-submodule status
642bcd2d011ce8c32a0a69bfb4fd6942593584bb rails (v2.0.0-788-g642bcd2)
[proforma]$ rm -rf vendor/rails
[proforma]$ git submodule add git://github.com/rails/rails.git vendor/
‘vendor’ already exists
[proforma]$ git-config --list
user.name=James B. Byrne
[email protected]
color.diff=auto
color.status=auto
color.branch=auto
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
submodule.rails.url=/home/byrnejb/Software/Development/Projects/proforma/vendor/rails/.git
[proforma]$ git submodule init
[proforma]$ git submodule update
[proforma]$ ll vendor
total 8
drwxrwxr-x 14 byrnejb byrnejb 4096 Apr 17 16:14 plugins
[proforma]$
As shown, these commands do not provide the desired result. the rails
directoty is not pulled from the repository. I suppose that I can
remove vendor as well and try again but this seems a bit draconian. Am I
missing a step?
James B. wrote:
Having added a submodule in Git, how does one remove it?
Did not look hard enough, although the answer is a bit obscure:
Edit the file .gitmodules in the git project root directory to remove
the unwanted reference.
Having added a submodule in Git, how does one remove it?
I did this:
git submodule add add git://github.com/rails/rails.git
When really I should have done this:
git submodule add add git://github.com/rails/rails.git vendor/rails
Now when I do a git submodule update I keep recreating a rails directory
immediately beneath the project root. I cannot seem to find any
discussion of removing a submodule from git so, if anyone here knows how
it is done, I would be most appreciative learning how.
I have a project in a remote GiT repository that was imported from a
Subversion repository. I git-clone this to my local machine and none of
the svn externals are preserved. No surprise there. However, I want to
add edge rails as a submodule to my local GiT clone and push this back
to the master.
Doing this at the root of the cloned repository does not seem to work:
git submodule add git://github.com/rails/rails.git vendor/rails
git submodule init
git submodule update
# This does nto seem to accomplish anything:
git-push git-push --all --dry-run
Everything up-to-date
Is there a way to add git submodules to a git-clone and push them back
to the master so that future pulls and clones will get them as well?
I need just a little more help in cleaning this up:
James B. wrote:
Having added a submodule in Git, how does one remove it?
Did not look hard enough, although the answer is a bit obscure:
Edit the file .gitmodules in the git project root directory to remove
the unwanted reference.
Removing the unwanted reference from .gitmodules and from .git/config is
not enough. There is a reference to the defunct submodule kept in
.git/index. How does one remove that?
One more thing. As of git version 1.5.5.2 git-svnimport is gone. The
only way to move from subversion to git is via git-svn.
James B. wrote:
Is there a way to add git submodules to a git-clone and push them back
to the master so that future pulls and clones will get them as well?
Yes, do not forget to run git-commit first