检查远程 ftp 上的版本?
我有一个简单的问题,但目前没有找到解决方案。
我使用 Git 来跟踪本地和 github 上的网站文件。 我有一个OVH帐户和自己的域名,有存储空间。
当我的代码在本地测试时,我将文件从最新版本上传到 ftp。 我只想确保我的网站拥有最新版本的代码。
由于我在 OVH 存储中没有任何终端访问权限,因此我无法执行任何 git log 或 git pull。 那么,确保拥有最新版本的最简单方法是什么?
我想过在执行 git 提交时自动增加一个文件,但发现没有办法自动执行此操作......
任何帮助将不胜感激。
谢谢 !
I got a simple question, but found no solution for now.
I use Git to keep trace of my website files, both locally and on github.
I have an account at OVH and my own domain name, with storage space.
When my code is tested locally, I upload files from the last version to the ftp.
I would like to simply be sure that my website has the last version of my code.
As I do not have any terminal access in my OVH storage, I cannot perform any git log nor git pull.
So, what would be the simplest way to be sure to have the last version?
I thought about having a file autmatically incremented when performing a git commit, but found no way to do this automatically .. .
Any help would be appreciated.
Thanks !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
请记住,在 git 中,您始终有一个
HEAD
“变量”,它指向当前分支的最新提交。如果你查看隐藏文件 .git/HEAD ,你会发现它指向 git 文件夹中的另一个文件,该文件与你当前分支到 .git/ 的名称相同。 refs/heads/,例如
.git/refs/heads/master
如果在本地克隆中,您位于 master 分支。这些文件包含每个分支的最新版本号。您可以考虑下载该文件(或者如果您愿意,仅下载主分支)并根据您所知的最新版本哈希检查其内容。
Remember that in git you always have a
HEAD
"variable" that points to the latest commit of your current branch.If you look into the hidden file
.git/HEAD
you will see that it points to another file in the git folder, that is something with the same name as your current branch into.git/refs/heads/
, e.g..git/refs/heads/master
if in your local clone you're in the master branch. Those files contains the latest version number for each branch.You could consider downloading that files (or only for the master branch if you wish) and check their contents with respect to the version hash you know as the latest.
您可以使用a tost-ceeive hook 以便与(未经证实)文件恢复其中的“描述”。
从那里,您可以将自己的本地
git描述
与该文件进行比较。You could use a post-receive hook in order to generate an (unversionned) file with the resumt of 'git describe' in it.
From there, you can compare your own local
git describe
with that file.我认为在提交时增加版本文件是一个不错的开始方法。
您可以使用 git hooks 自动执行此操作(我相信 GIT_DIR/hooks/pre-commit 是你应该寻找什么)
I think incrementing version file on commit is an OK approach to start with.
You can do it automatically with git hooks (I believe GIT_DIR/hooks/pre-commit is what you should be looking for)