Reputation: 5624
I have a git repo which have following folders:
_includes/
_layouts/
_plugins/
_posts/
_site/
_site folder is added in the .gitignore
file.
Now can I have a git repo inside _site folder with different remote repo for push and pull? Will there be any conflict?
I have studied git submodules but I think it would be a overkill in my case, if the above stated method can work.
Upvotes: 38
Views: 7533
Reputation: 1170
Yes - I just tried it. Here is my command line session:
$ mkdir temp
$ cd temp
$ git init
Initialized empty Git repository in /Users/mpdaugherty/temp/.git/
$ git add .
$ git status
# On branch master
#
# Initial commit
#
nothing to commit (create/copy files and use "git add" to track)
$ echo 'ignore' >> .gitignore
$ git add .
$ git commit -a -m 'first commit'
[master (root-commit) 17d293c] first commit
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 .gitignore
$ mkdir ignore
$ git status
# On branch master
nothing to commit (working directory clean)
$ cd ignore
$ git init .
Initialized empty Git repository in /Users/mpdaugherty/temp/ignore/.git/
$ echo 'Some text' > somefile.txt
$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# somefile.txt
nothing added to commit but untracked files present (use "git add" to track)
$ git add .
$ git commit -a -m 'initial commit'
[master (root-commit) 107f980] initial commit
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 somefile.txt
$ cd ..
$ git status
# On branch master
nothing to commit (working directory clean)
Upvotes: 12
Reputation: 2137
I think it should work. For main repo, _site
folder does not exists. So what you have inside it doesn't matter. When you cd
into _site
you will be on that independent repo.
Upvotes: 24