Check version on remote ftp?
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 !
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.
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.
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)
精彩评论