Using git with drupal: Difference between revisions
m added Category:Drupal using HotCat |
m Text replacement - "<(\/?)source" to "<$1syntaxhighlight" Tags: Mobile edit Mobile web edit |
||
| Line 1: | Line 1: | ||
I forked the drupal project from git://github.com/mikl/drupal.git (my "origin") so that I could start with official upstream drupal sources. I then created my own private remote repository that I can push to (iic-drupal), and have made a number of commits (using a different computer). Now I'm on a machine where I want to pull from iic-drupal, but if I do 'git pull' it complains (see below). This gist describes how I fixed my configuration, and clears up for me how in a DISTRIBUTED VCS, you need to tell the system which local branch you are working with, and equally important, which remote AND branch on that remote you want to pull code from. | I forked the drupal project from git://github.com/mikl/drupal.git (my "origin") so that I could start with official upstream drupal sources. I then created my own private remote repository that I can push to (iic-drupal), and have made a number of commits (using a different computer). Now I'm on a machine where I want to pull from iic-drupal, but if I do 'git pull' it complains (see below). This gist describes how I fixed my configuration, and clears up for me how in a DISTRIBUTED VCS, you need to tell the system which local branch you are working with, and equally important, which remote AND branch on that remote you want to pull code from. | ||
< | <syntaxhighlight lang="bash"> | ||
$ cat .git/config | $ cat .git/config | ||
</ | </syntaxhighlight> | ||
<pre> | <pre> | ||
[core] | [core] | ||
| Line 17: | Line 17: | ||
</pre> | </pre> | ||
< | <syntaxhighlight lang="bash"> | ||
$ git branch | $ git branch | ||
</ | </syntaxhighlight> | ||
<pre> | <pre> | ||
* iic-dev | * iic-dev | ||
| Line 25: | Line 25: | ||
master | master | ||
</pre> | </pre> | ||
< | <syntaxhighlight lang="bash"> | ||
$ git pull | $ git pull | ||
</ | </syntaxhighlight> | ||
<pre> | <pre> | ||
From git://github.com/mikl/drupal | From git://github.com/mikl/drupal | ||
| Line 57: | Line 57: | ||
tell git to pull (fetch and merge into the local branch) code from the "iic-drupal" remote, using the "iic-dev" branch found there. | tell git to pull (fetch and merge into the local branch) code from the "iic-drupal" remote, using the "iic-dev" branch found there. | ||
< | <syntaxhighlight lang="bash"> | ||
$ git pull iic-drupal iic-dev | $ git pull iic-drupal iic-dev | ||
</ | </syntaxhighlight> | ||
<pre> | <pre> | ||
From git@svn.iic.harvard.edu:repositories/drupal | From git@svn.iic.harvard.edu:repositories/drupal | ||
| Line 68: | Line 68: | ||
</pre> | </pre> | ||
< | <syntaxhighlight lang="bash"> | ||
$ git branch -a | $ git branch -a | ||
</ | </syntaxhighlight> | ||
<pre> | <pre> | ||
* iic-dev | * iic-dev | ||
| Line 95: | Line 95: | ||
tell my local repository that the local branch "iic-dev" has a remote repository to track called "iic-drupal" (already defined in "remotes") | tell my local repository that the local branch "iic-dev" has a remote repository to track called "iic-drupal" (already defined in "remotes") | ||
< | <syntaxhighlight lang="bash"> | ||
$ git config branch.iic-dev.remote iic-drupal | $ git config branch.iic-dev.remote iic-drupal | ||
</ | </syntaxhighlight> | ||
tell my local repository that the local development branch "iic-dev" should be merged with code fetched from the remote development branch (also called "iic-dev") | tell my local repository that the local development branch "iic-dev" should be merged with code fetched from the remote development branch (also called "iic-dev") | ||
< | <syntaxhighlight lang="bash"> | ||
$ git config branch.iic-dev.merge iic-dev | $ git config branch.iic-dev.merge iic-dev | ||
</ | </syntaxhighlight> | ||
[[Category:Drupal]] | [[Category:Drupal]] | ||