Management Code Development 2

This is the second part in in our series of Code Management for Developers.
So recently I made some modifications for a new feature locally and then when deploying I asked myself how different was the code that was already on the server from the code base. In order to find out I had to download a copy of the remote file and do a diff:
diff -b local_file.txt remote_file.txt
The output of the diff would indicate to me whether it was just my modifications that created the difference. In case it was so I just had to overwrite the files. In another case I had to merge the changes into one file and upload that file.
That was a tedious task doing it by hand. So a script was actually needed to download a local copy of the files that I had modified, compare them to my versions, merge them, and uploading them back. The first problem we encounter is to realize which files I had modified! I used the names of the branches. Master branch compared to the branch I was in that had the modifications.
To that the git diff command came to our rescue:
git diff master beatity_variations –stat
This would list the files for me:
…/wp-e-commerce/transaction_result_functions.php | 10 ++++-
wp-content/plugins/wp-e-commerce/user-log.php | 37 +++++++++++——-
…/plugins/wp-e-commerce/widgets/luis_widget.php | 41 +++++++————
…/wp-e-commerce/wpsc-includes/cart.class.php | 38 ++++++++++++++++++
…/wpsc/themes/iShop/shopping_cart_page.php | 3 +-
5 files changed, 86 insertions(+), 43 deletions(-)
With this information I was able to do the job however it was manual and I was asked once to restore to previous versions of the remote files after I modified them. This latter request called the support for an “unpatch” feature in to question.

Leave a Reply

Your email address will not be published. Required fields are marked *