当我已经拥有多个分支时,我应该如何添加新文件

时间:2022-09-19 15:09:20

We have recently started using GIT and it has worked out well, but we sometimes hits bumps that we don't know how to best solve.

我们最近开始使用GIT并且它运行良好,但我们有时遇到了一些我们不知道如何最好地解决的问题。

Right now we have multiple branches. master, develop and lots of feature branches (one or more per developer).

现在我们有多个分支机构。掌握,开发和许多功能分支(每个开发人员一个或多个)。

Now we want to add a directory with some script-files, and these files are needed by all developers (immediately).

现在我们要添加一个带有一些脚本文件的目录,所有开发人员都需要这些文件(立即)。

How should we best perform this? I was thinking maybe adding a new branch (from develop), add the files there and then let everyone else merge from it?

我们该如何做到最好?我想也许可以添加一个新的分支(来自开发),在那里添加文件,然后让其他人从中合并?

Or is there a better, cleaner, more git'ish way to do this?

或者是否有更好,更清洁,更灵巧的方式来做到这一点?

2 个解决方案

#1


1  

Just add it to your central branch (normally dev or develop) and ask everyone to git merge or git rebase from it, which they are normally meant to be doing regularly anyway.

只需将它添加到您的中心分支(通常是开发或开发)并要求每个人从它进行git merge或git rebase,无论如何它们通常都是定期进行的。

#2


1  

Either record the ancestry explicitly by making the new commit at the merge base of all the branches then git merge --no-ffing that, or make the new commit anyplace and cherry-pick it from everywhere else. There's a very widely-used branching model that uses the branch-and-merge-no-ff method.

通过在所有分支的合并基础上进行新提交来显式记录祖先,然后git merge --no-ffing,或者在任何地方进行新提交并从其他地方挑选它。有一个非常广泛使用的分支模型,它使用branch-and-merge-no-ff方法。

#1


1  

Just add it to your central branch (normally dev or develop) and ask everyone to git merge or git rebase from it, which they are normally meant to be doing regularly anyway.

只需将它添加到您的中心分支(通常是开发或开发)并要求每个人从它进行git merge或git rebase,无论如何它们通常都是定期进行的。

#2


1  

Either record the ancestry explicitly by making the new commit at the merge base of all the branches then git merge --no-ffing that, or make the new commit anyplace and cherry-pick it from everywhere else. There's a very widely-used branching model that uses the branch-and-merge-no-ff method.

通过在所有分支的合并基础上进行新提交来显式记录祖先,然后git merge --no-ffing,或者在任何地方进行新提交并从其他地方挑选它。有一个非常广泛使用的分支模型,它使用branch-and-merge-no-ff方法。