如何使用 PHP 项目中的 specific/selected 个文件创建一个 git 分支?

How to make a git branch with only specific/selected files from a PHP project?

我完全是这个 Git 的新手。

我的 PHP 项目文件已被管理员添加到 Git。

现在一个新人将开始从事这个项目。他将负责该项目的一个模块。因此,作为一名高级开发人员,我被要求为他创建一个分支,该分支将只包含他在特定模块上开始工作所需的特定文件。

所以这件事在我脑海中产生了很多问题:

  1. 我可以只用项目中的 specific/selected 个文件为他创建一个特殊的分支吗?如果是,如何?如果不是,为什么?
  2. 现在只存在项目的主分支。如果为新开发人员创建了 git 的新分支,并且他提交并推送了他对 git 所做的更改;他们将如何与主分支合并?我是否需要使用 'DeployHQ' 之类的第三方工具或类似工具手动完成此操作,或者是否有任何解决方法。
  3. 为了让他轻松一些,我想做的是他应该能够提交、推送更改,这些更改会立即反映在服务器上,他应该能够通过 运行 浏览器中的页面。我能不能像我想的那样简单易行。

简而言之,我不想向他透露我所有的项目文件,并希望让事情对我和他来说都变得更简单。

请指导我。

谢谢。

GIT 版本控制的基本构建块是项目。您不能仅从 master 分支出一些文件,因为在项目是单一版本控制实体的环境中它没有任何意义。

您可以在分支中添加或删除文件,然后将更改提交给 master。

Some people refer to the branching model in Git as its “killer feature” , and it certainly sets Git apart in the VCS community. Why is it so special? The way Git branches is incredibly lightweight, making branching operations nearly instantaneous and switching back and forth between branches generally just as fast. Unlike many other VCSs, Git encourages a workflow that branches and merges often, even multiple times in a day. Understanding and mastering this feature gives you a powerful and unique tool and can literally change the way that you develop.