简体   繁体   中英

Adding GIT to copy of the source code

On legacy project with 2 environments prod and dev .
We recently added git on prod and pushed all the changes in the master branch, and can now support this server better.

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...

What are the proper steps to add git repository tracking, to existing code, similar to the master branch ?

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 pull says all is up to date

  1. Clone your new repo to a stand-alone server
  2. In cloned repo create a new branch 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
  6. Merge develop branch into master . This will be a new prod codebase.

Disclamer. This is not an endorsement of a proper release process, just the answer to OP problem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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