【问题标题】:Git checkout from one directory to another on server (cloudways)Git 从一个目录签出到服务器上的另一个目录(cloudways)
【发布时间】:2016-07-19 10:18:45
【问题描述】:

我在 Cloudway DigitalOcean 上有一个 laravel 应用程序,我的应用程序在 /public_html ,我想使用 git 更新我的应用程序,所以我创建了文件夹 private_html/git ,我从 @987654325 中提取我编辑的项目@,现在我想结帐到我的public_html/,我该怎么做?谢谢你

【问题讨论】:

    标签: php git laravel laravel-4 cloudways


    【解决方案1】:

    您可以通过 git 将更改部署到 public/html 或手动复制文件。

    手动复制选项

    取决于完整路径,例如:

    cp -a private_html/git/. public_html/

    注意:-a 是保留文件属性的递归选项

    这不会删除已在 private_html/git 中删除的任何文件,因此您必须手动执行此操作,或者在复制文件之前删除所有内容。

    Git 拉取选项

    首先,确保您已将 private_html/git 中所做的所有更改推送到您的远程(bitbucket 存储库)。

    public_html/中的当前副本设置为git repo。

    在 public_html/

    git init

    然后添加位桶远程

    git remote add origin git@bitbucket.org:user-name/repo-name

    注意:从您的 bitbucket 帐户获取正确的 bitbucket 远程

    然后从远程拉取更改

    git fetch --all

    git reset --hard origin/master

    警告:您将丢失public/html 中当前存在的所有差异,因此请小心。在进行此类更改之前备份所有内容总是一个好主意,因此我建议在覆盖之前将代码存档在public_html

    【讨论】:

    • 我认为您在 git pull 上遗漏了一些步骤,因为该工作树中已经有一个存储库。
    猜你喜欢
    • 2018-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-21
    • 2013-09-20
    • 2014-06-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多