Skip to content

Instantly share code, notes, and snippets.

@parasquid
Last active August 29, 2015 14:04
Show Gist options
  • Save parasquid/b0652fe71d46320d539d to your computer and use it in GitHub Desktop.
Save parasquid/b0652fe71d46320d539d to your computer and use it in GitHub Desktop.
Sync the production branch with the master branch before deployment
tristan@tristan-vbox ~/Sites/lightbringer $ cap production deploy
INFO [8ec98abf] Running /usr/bin/env git checkout master on
DEBUG [8ec98abf] Command: ( RAILS_ENV=production /usr/bin/env git checkout master )
DEBUG [8ec98abf] Already on 'master'
INFO [8ec98abf] Finished in 0.168 seconds with exit status 0 (successful).
INFO [61300fdb] Running /usr/bin/env git pull origin master on
DEBUG [61300fdb] Command: ( RAILS_ENV=production /usr/bin/env git pull origin master )
DEBUG [61300fdb] Already up-to-date.
DEBUG [61300fdb] From github.com:mindvalley/lightbringer
DEBUG [61300fdb] * branch master -> FETCH_HEAD
INFO [61300fdb] Finished in 4.106 seconds with exit status 0 (successful).
INFO [94dd119e] Running /usr/bin/env git checkout production on
DEBUG [94dd119e] Command: ( RAILS_ENV=production /usr/bin/env git checkout production )
DEBUG [94dd119e] Switched to branch 'production'
INFO [94dd119e] Finished in 0.226 seconds with exit status 0 (successful).
INFO [3f9bf660] Running /usr/bin/env git pull --rebase origin production on
DEBUG [3f9bf660] Command: ( RAILS_ENV=production /usr/bin/env git pull --rebase origin production )
DEBUG [3f9bf660] Current branch production is up to date.
DEBUG [3f9bf660] From github.com:mindvalley/lightbringer
DEBUG [3f9bf660] * branch production -> FETCH_HEAD
INFO [3f9bf660] Finished in 5.190 seconds with exit status 0 (successful).
INFO [18449352] Running /usr/bin/env git rebase master on
DEBUG [18449352] Command: ( RAILS_ENV=production /usr/bin/env git rebase master )
DEBUG [18449352] First, rewinding head to replay your work on top of it...
DEBUG [18449352] Fast-forwarded production to master.
INFO [18449352] Finished in 0.577 seconds with exit status 0 (successful).
INFO [5183878f] Running /usr/bin/env git push origin production on
DEBUG [5183878f] Command: ( RAILS_ENV=production /usr/bin/env git push origin production )
DEBUG [5183878f] To git@github.com:mindvalley/lightbringer.git
DEBUG [5183878f] 73de8eb..add744a production -> production
INFO [5183878f] Finished in 4.442 seconds with exit status 0 (successful).
before :deploy, :sync_production_to_master do
run_locally do
execute :git, 'checkout master'
execute :git, 'pull origin master'
execute :git, 'checkout production'
execute :git, 'pull --rebase origin production'
execute :git, 'rebase master'
execute :git, 'push origin production'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment