简体   繁体   English

将GIT添加到源代码的副本中

[英]Adding GIT to copy of the source code

On legacy project with 2 environments prod and dev . 在具有两个环境proddev的遗留项目上。
We recently added git on prod and pushed all the changes in the master branch, and can now support this server better. 我们最近在prod上添加了git并将所有更改推送到master分支中,现在可以更好地支持此服务器。

However I have trouble initiating the git tracking on our dev server, there code base there is a bit different and I can not just clone it fresh... 但是我在我们的开发服务器上启动git跟踪时遇到了麻烦,那里的代码库有些不同,我不能只是将其克隆...

What are the proper steps to add git repository tracking, to existing code, similar to the master branch ? 类似于master分支,将git仓库跟踪添加到现有代码中的适当步骤是什么?

I tried: 我试过了:

git init
git origin add remote ...
git branch --set-upstream master origin/master

But now all my local files are shown as locally deleted. 但是现在我所有的本地文件都显示为本地删除。

git checkout master shows conflict on all files git checkout master在所有文件上显示冲突
git pull says all is up to date git pull说一切都是最新的

  1. Clone your new repo to a stand-alone server 将新存储库克隆到独立服务器
  2. In cloned repo create a new branch develop 在克隆回购创建一个新的分支develop
  3. Rsync your codebase from your dev server into this repo 将代码库从开发服务器同步到此存储库中
  4. Commit 'develop' branch and push to remote. 提交“开发”分支并推送到远程。
  5. Setup your dev server to track develop branch 设置您的开发服务器以跟踪develop分支
  6. Merge develop branch into master . develop分支合并为master This will be a new prod codebase. 这将是一个新的prod代码库。

Disclamer. 免责声明。 This is not an endorsement of a proper release process, just the answer to OP problem 这不是对正确发布过程的认可,而只是对OP问题的答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM