在现有Git存储库上创建客户端/服务器文件夹结构

时间:2019-10-22 11:37:00

标签: angular git ionic4 git-repo

我有一个git存储库,现在我需要向其中添加客户端和服务器文件夹。即将所有与Ionic相关的内容放入客户端文件夹,并将与NodeJs相关的内容放入服务器文件夹。我这样做是这样的:

enter image description here

我已经有一个没有此文件夹结构的git repo。即基本的Ionic 4应用程序的git repo 那么如何创建这种结构并将其推送到相同的仓库中?

我已经尝试过了。但是它给出了以下错误。我也尝试过git pull,但还没有走运。

    git push --set-upstream origin master To https://gitlab.com/my-repo/client.git  ! [rejected]        
master -> master (non-fast-forward) error: failed to push some refs to 'https://gitlab.com/my-
repo/client.git' hint: Updates were rejected because the tip of your current branch is behind hint: its 
remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: 
See the 'Note about fast-forwards' in 'git push --help' for details.

注意:实际上,我的本地分支机构是最新的远程master。在创建上面的文件夹结构之前,我已经完成了它。

1 个答案:

答案 0 :(得分:0)

当您执行git pull时,它会看到很多不相关的历史记录,并且拒绝合并和从远程分支中提取代码,如您在错误堆栈中所见,请尝试使用:

  

git pull origin master --allow-unrelated-histories

From https://github.com/NishuGoel/ExampleStackOverFlow
 * branch            master     -> FETCH_HEAD
CONFLICT (add/add): Merge conflict in README.md
Auto-merging README.md
CONFLICT (add/add): Merge conflict in .gitignore
Auto-merging .gitignore
Automatic merge failed; fix conflicts and then commit the result.

这带来了不相关的更改,之后您可以通过手动解决在编辑器中看到的冲突来合并更改。 (左侧VS Code中的源代码管理。)

最后提交并推送结果。

希望这会有所帮助!