Skip to content

Instantly share code, notes, and snippets.

@priithaamer
Created June 29, 2010 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save priithaamer/456958 to your computer and use it in GitHub Desktop.
Save priithaamer/456958 to your computer and use it in GitHub Desktop.
Capistrano tasks to show git diff and log between local and remote environments
namespace :git do
desc 'Shows a Git diff between the current version on server and latest on HEAD'
task :diff_pending do
local_sha = `git rev-parse --verify HEAD`
remote_sha = capture("cd #{current_path}; git rev-parse --verify HEAD")
puts `git diff #{remote_sha.strip} #{local_sha.strip}`
end
desc 'Shows a Git log between the current version on server and latest on HEAD'
task :log_pending do
local_sha = `git rev-parse --verify HEAD`
remote_sha = capture("cd #{current_path}; git rev-parse --verify HEAD")
puts `git log #{remote_sha.strip}..#{local_sha.strip}`
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment