简体   繁体   English

使用GIT和RSYNC进行部署

[英]Deploy with GIT and RSYNC

I have a question about GIT and RSYNC because I use these two commands for make a deploy but I want upload my files to a FTP server (production) of the files that I have in my master branch only!! 我有一个关于GIT和RSYNC的问题,因为我使用这两个命令进行部署,但是我想将文件上传到仅在master分支中的文件的FTP服务器上(生产)! (This is my problem). (这是我的问题)。

Example: 例:

  1. I create a new branch and I make changes in different files of this branch. 我创建一个新分支,并在该分支的不同文件中进行更改。 In this moment other people of my team did changes and he did a push to master branch. 在这一刻,我们团队中的其他人进行了更改,他推动了分支机构的发展。 And is necessary upload these files to FTP Server. 并且有必要将这些文件上传到FTP服务器。

Then... 然后...

I put the followings commands in "MyBranch": 我在“ MyBranch”中放置了以下命令:

git add .
git commit -m "My changes"
git checkout master
git merge MyBranch
git pull origin master

and then I make a rsync to a FTP Server. 然后将rsync同步到FTP服务器。

I want make add and commit my changes in my branch for then switch to a master branch and make the pull for get the changes of my team and then realize the deploy. 我想要在分支中进行添加并提交更改,然后切换到主分支并进行拉动以获取团队的更改,然后实现部署。

In other words, I want upload to FTP only the files in the master branch!!! 换句话说,我只想将master分支中的文件上传到FTP! Is this Possible?? 这可能吗??

Thank's 谢谢

You can just do : 您可以这样做:

git add .
git commit -m "My changes"
git checkout master
git pull origin master
  • 1 and 2nd commands commit your changes to MyBranch 1和2nd命令将您的更改提交到MyBranch
  • 3rd switch your working branch to master 第三将您的工作分支切换到主
  • 4th get the latest remote version of master 4号获得master的最新远程版本

Then you can do your rsync upload to your server. 然后,您可以将rsync上传到服务器。 It will contain the most recent version of 'master' ie master with your team changes. 它将包含“ master”的最新版本,即您的团队变更的master。

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

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