title: Rails 4 - capistrano 3 doesn't deploy last commits
body: <p>We have a production environment for a Rails 4 app with Apache, Phusion Passenger, and Capistrano 3, and a remote bitbucket repository. The Capistrano's "cap production deploy" works well, and executes without errors. But when we go the "current" folder on the remote server, and do a "git log" command, the last commits of our remote repository aren't loaded. </p>
  
  <p>We've tried the "git log" in the main folder of our app, same problem. </p>
  
  <p>Our question is, who can we load the last commits of our repo into the production env ? Isn't Capistrano made to do it by default ?</p>
  
  <p>Any idea of where it could come from ? </p>
  
  <p>Here is the code of our Capfile, deploy.rb and deploy/production.rb files : </p>
  
  <p><strong>Capfile</strong></p>
  
  <pre><code># Load DSL and Setup Up Stages
  require 'capistrano/setup'
  
  # Includes default deployment tasks
  require 'capistrano/deploy'
  
  
  require 'rvm1/capistrano3'
  require 'capistrano/bundler'
  require 'capistrano/rails/assets'
  require 'capistrano/rails/migrations'
  
  # Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
  Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
  
  Dir.glob('lib/capistrano/**/*.rb').each { |r| import r }
  </code></pre>
  
  <p><strong>deploy.rb</strong></p>
  
  <pre><code>lock '3.1.0'
  
  set :application, 'XXXXXXX'
  set :deploy_user, 'XXXXXXX'
  
  set :repo_url, 'GIT_REPO_URL.XXXXXXX.git'
  
  set :keep_releases, 5
  
  set :rvm_type, :user
  set :rvm_ruby_version, 'ruby-2.1.2'
  set :default_env, { rvm_bin_path: '/usr/local/rvm/bin' }
  
  
  set :bundle_dir, "/usr/local/bin"
  
  set :ssh_options, {:forward_agent =&gt; true}
  
  set :linked_files, %w{config/database.yml config/application.yml}
  
  set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
  
  set :tests, []
  
  set(:config_files, %w(
    apache2.conf
    database.example.yml
    log_rotation
    unicorn.rb
    unicorn_init.sh
  ))
  
  set :log_level, :debug
  
  set :pty, true
  
  set :assets_roles, [:app]
  
  # which config files should be made executable after copying
  # by deploy:setup_config
  set(:executable_config_files, %w(
    unicorn_init.sh
  ))
  
  # files which need to be symlinked to other parts of the
  # filesystem. For example nginx virtualhosts, log rotation
  # init scripts etc.
  set(:symlinks, [
    {
      source: "apache2.conf",
      link: "/etc/apache2/sites-enabled/#{fetch(:full_app_name)}"
    },
    {
      source: "unicorn_init.sh",
      link: "/etc/init.d/unicorn_#{fetch(:full_app_name)}"
    },
    {
      source: "log_rotation",
     link: "/etc/logrotate.d/#{fetch(:full_app_name)}"
    }
  ])
  
  
  namespace :deploy do
     task :start do ; end
     task :stop do ; end
     desc 'Restart application'
     task :restart do
      on roles(:all), in: :sequence, wait: 5 do
        # Your restart mechanism here, for example:
        execute :touch, release_path.join('restart.txt')
      end
    end
  
    task :stop_node do
      on roles(:all), in: :sequence do
        #Stop the node_server
        execute "nohup node ./realtime/node_server.js &amp;"
      end
    end
    task :restart_node do
      on roles(:all), in: :sequence do
        #Restart the node_server
        execute "nohup node ./realtime/node_server.js &amp;"
      end
  
    end
  end
  
  # Bundle install configuration
  set :bundle_without, %w{development test}.join(' ')
  set :bundle_roles, :all
  namespace :bundler do
    desc "Install gems with bundler."
    task :install do
      on roles fetch(:bundle_roles) do
        with RAILS_ENV: fetch(:environment) do
          within release_path do
            execute :bundle, "install", "--without #{fetch(:bundle_without)}"
          end
        end
      end
    end
  end
  before 'deploy:updated', 'bundler:install'
  before 'deploy:restart', 'bundler:install'
  after 'deploy:updated', 'deploy:publishing'
  after 'deploy:restart','deploy:restart_node'
  </code></pre>
  
  <p><strong>deploy/production.rb</strong></p>
  
  <pre><code>set :stage, :production
  set :branch, "REPO_BRANCH"
  
  set :full_app_name, "#{fetch(:application)}_#{fetch(:stage)}"
  set :server_name, "XXXXXXX.com www.XXXXXXXX.com"
  
  set :password, ask('Server password', nil)
  
  
  server 'XXXXXX.com', user: 'XXXXXX', password: fetch(:password), port: 22,  roles: %w{web app}, primary: true
  
  set :deploy_to, '/PATH/TO/APP'
  
  
  set :rails_env, :production
  set :environment, "production"
  
  set :unicorn_worker_count, 5
  
  set :enable_ssl, false
  </code></pre>