pocketarc / git-deploy-php

git-deploy-php is a simple php-based tool that deploys your Git repositories to FTP/SFTP servers, and keeps them updated automatically.
http://brunodebarros.github.io/git-deploy-php
291 stars 45 forks source link

Check the alignment with the remote before the deploy #79

Closed roibeart closed 6 years ago

roibeart commented 6 years ago

Hi,

First of all thank you a lot for this nice tool. In the company where I work we use it for small projects and it comes very handy.

Anyway, since it happens that on a project can work more than one person, I thought could be useful to add a option to check – before performing the deploy – if a repository is in sync with the remote.

This is what I have done: I implemented the possibility to define in the .ini file a option check_sync_with_remote that, if it is set to true, the tool will check if the remote is aligned with the local repository. If this verification fails, the deploy will not be performed. In the case remote is called origin, it is also possible to specify the branch of the remote where to check the alignment, defining it through the option remote_branch.

pocketarc commented 6 years ago

This is great! I've reviewed it and it looks good to me. Merged!

I also noticed you add some colouring for the messages; that's a great idea. I've been looking into switching to http://climate.thephpleague.com for all the CLI-related work (options, colours, formatting). I've already used it for a couple of other projects, and it'd clean up git-deploy's code a fair bit.

(Also, in the future we'll have unit tests to make sure everything always works, instead of having to do manual reviews/testing.)

roibeart commented 6 years ago

Thank you, I'm glad you appreciated it!

Regarding the colouring yes, I forgot to tell you about that change. I decided to add it in order to give to the user an immediate visual feedback. Anyway switching to a specialized library that simplifies the code related to the CLI operations is certainly a good idea.