title: Best practices for using git in website deployments
body: <p>I'm doing an internship for a period of five months at a company at the moment and I'm going to change the way that developers access files, aka git instead of plain ftp access. Everything with git is going fine untill now, I'm a bit familiar with the usage after a month of using it.</p>
  
  <p>This is what I have in mind right now:</p>
  
  <p><img src="https://i.stack.imgur.com/TweSh.png" alt="enter image description here"></p>
  
  <p>We are using beanstalk as a repo hoster, which comes with a deployment function that works realy easy, so that part is covered. The part that gets me thinking is branch-wise. I was thinking of making a branch called 'Live' and just 'master'. master will be deployed to the development website (top right on the picture) and the live branch will be deployed to the live website. Also, the live website deployment will be manual, but the master should be automaticly, so far, no problem.</p>
  
  <p>When I think of a scenario of small changes to the live website, there is where it gets complicated. Let's say I need to change the padding of some random div, I do not want to deploy the latest build with a half implemented api to the live website, <strong>I only want to deploy the small change</strong>, is this possible some way?</p>
  
  <p>The way I see it now is do the fix on two places, first pull the master branch and fix it, then do the same for the live branch. But this will get harder with bigger changes.</p>
  
  <p>Also, since we use Wordpress for pretty much everything, most of the data will be stored in the database. This is realy nice because we just need to clone the live database every now and then and we're done. But when image uploading comes into play, stuff gets pretty ugly. The repo will have a few of the images in it (because we didnt use git since the very beginning they are in there from a full copy) and others that will be added later will just sit there in the ftp dir, pretending they are in the repo!</p>
  
  <p>Would it be better to not include folders like cache and media in git <em>at all</em>, or only some, or just update it once in a while?</p>
  
  <p>Those are pretty much my two biggest problem of them all.</p>
  
  <p>tl;dr: How to commit small changes to a branch that is out of date without doing it twice (also for master). And what is normal usage of cache/media files in a git repo?</p>