[英]making sure Git merge / pull from remote fully updates repo
have question its not about a particular bit of code.有疑问它不是关于特定的代码。
Have 3 git repositories, one is local (dev), one production (site with a domain name), and a remote repo at a code site like github.拥有 3 个 git 存储库,一个是本地(开发),一个是生产(具有域名的站点),以及位于代码站点(如 github)的远程存储库。
I decided to do my changes to code in local repo, pushing them to the remote repo, then ssh into the server production repo and fetch/merge or pull updates from remote repo.我决定对本地仓库中的代码进行更改,将它们推送到远程仓库,然后将 ssh 放入服务器生产仓库并从远程仓库获取/合并或提取更新。
Today I did it second time to update some content.今天我做了第二次更新一些内容。 Fetch and merge did not go well, part of the code was updated but part (eg. styling) was obviously missing.
获取和合并没有 go 很好,部分代码已更新,但部分(例如样式)显然丢失了。 Second time I tried just pulling to prod server from remote, and this time it seemed to work as things looked apparently right.
第二次我尝试从远程拉到 prod 服务器,这一次它似乎可以正常工作,因为事情看起来显然是正确的。 But browsing I notice a few small changes are not applied.
但是浏览我注意到没有应用一些小的更改。
found fix: git reset --hard origin/master找到修复:git reset --hard origin/master
This applied all changes to prod repo.这将所有更改应用于 prod repo。 But now Im worried anytime I pull to prod repo some small thing might not be applied.
但现在我担心任何时候我拉到 prod repo 一些小东西可能不会被应用。 How do I reliably update from a remote repo?
如何可靠地从远程仓库更新? Did I just do something wrong?
我是不是做错了什么? is there some setting I can change or do I need to do above fix every time?
是否有一些我可以更改的设置,或者我每次都需要进行上述修复?
How do I reliably update from a remote repo?
如何可靠地从远程仓库更新?
Through an automated process, which means a GitHub Action associated to a to_prod
branch.通过自动化过程,这意味着与
to_prod
分支关联的GitHub 操作。
Meaning:意义:
master
branch on GitHub, nothing happen.master
分支时,什么也没有发生。 You are just publishing your code to GitHub.to_prod
" branch, then a GitHub Action can run, and copy (FTP for example) that code to your production server.to_prod
”分支时,可以运行 GitHub 操作,并将该代码复制(例如 FTP)到您的生产服务器。 There are many GitHub Actions , but consider for instance SamKirkland/FTP-Deploy-Action
.有许多 GitHub Actions ,但考虑例如
SamKirkland/FTP-Deploy-Action
。
See also " Only run job on specific branch with GitHub Actions ":另请参阅“仅使用 GitHub 操作在特定分支上运行作业”:
on:
push:
branches:
- to_prod
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.