2

I'm new to GIT and Applying Security Patches. What is the most efficient way to apply a Magento Security Patch using GIT? Do I just push it to Magento's root directory and then use SSH to install it? I'm a bit confused because because looking at commit history it looks like other developers pushed difference files? Lastly, I have a total of 4 security patches to install. Should I commit them individually? or as a group? Thank you for any clarification.

2 Answers 2

2

Ideally you would create a new branch for your patch, then apply the patch and merge the branch for production when you are ready to deploy.

It would be best to put the patch number in your commit so other can see it (Find it later if needed)

As for deployment the rudimentary way would be to logon to your server via ssh and do a git pull origin master... of course this is not the best practice. But it will work.

I would put each patch separately in a new feature branch and then merge them to master.

5
  • 1
    Also you don't actually need to commit the patch file. Just run it locally and commit the changes it makes. Aug 5, 2015 at 21:47
  • @andrewkett if you don't commit your patch how does everyone else get that version of Magento you are working on? (say you have a team of 10 developers?) Aug 6, 2015 at 13:01
  • 1
    sorry not sure I understand your question. Just to be clear, I am not saying you don't need to commit anything, just the script used to apply the patch :) the applied.patches.list file should tell you everything you need about the patch you just applied Aug 6, 2015 at 14:15
  • @andrewkett I think I was getting the "Patch File" confused with the all the files that patch updates :) Aug 7, 2015 at 20:05
  • Should I also include all untracked files when installing patches? In this instance I am referring to: downloader/Maged/.htacces & downloader/lib/.htaccess
    – user9722
    Aug 9, 2015 at 14:24
0

You should clone the repo locally, apply the patches, and push the changes.

For example

git clone https://repo.example.com/company/magento ~/magento
cd ~/magento
mv ~/Downloads/PATCH_SUPEE* ./
bash PATCH_SUPEE-1.sh
git add .
git commit -m 'Applied patch SUPEE-1'
# Repeat line 4-6 for patch 2, 3, etc
git push origin master

Then deploy/pull the updated branch to your server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.