使用Git进行网站开发

时间:2014-01-07 17:22:13

标签: git version-control

我在网站开发中使用Git是新手,需要一个建议。 我有网站example.com(生产),它的克隆dev.example.com(开发) 目前我已经为每个人创建了2个git repos,并且可以分别提交并推送更改。 我正在为每个人使用这个解决方案:

创建裸仓库

cd /home/git/example.com.git
git init --bare

我的配置

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    worktree = /var/www/example.com/htdocs/
[receive]
    denycurrentbranch = ignore

文件:hooks / post-receive

#!/bin/sh
git checkout -f

并使其可执行

chmod +x hooks/post-receive

将文件推送到repo

cd /var/www/example.com/htdocs.default
git init
git add .
git commit -a -m "Initial Commit"
git remote add example.com git@example.com:example.com.git
git push example.com +master:refs/heads/master

和我的开发网站一样。所以我有2个不同的网站,2个git repos,作为开发人员,我必须在我的笔记本电脑上合并并推送到git dev repo,然后在浏览器中检查它,然后将其推送到我的生产仓库并在主网站上查看

是否有使用一个git存储库的解决方案(裸?)并且有两个分支:生产和开发,所以我可以:

  1. 在我的笔记本电脑上克隆开发
  2. 然后进行更改
  3. 将其推送到远程开发
  4. 在浏览器中检查它是否正常(当推送到dev时,它应该出现 在(/var/www/dev.example.com/htdocs)
  5. 将相同的更改从远程开发推送到远程生产,这样他们就可以了 出现在生产目录中(/var/www/example.com/htdocs)
  6. 如何配置git(我需要什么配置,命令)所以它可以这样做,主要问题是如何让他知道我对dev.example.com在我的浏览器中的外观感到满意并且他可以推送/合并/提交从开发到生产的这种变化? 感谢

0 个答案:

没有答案