Mage/Task/BuiltIn/Deployment/Strategy/GitRebaseTask.php
/**
     *
     * Deploying using git rebase strategy instead of rsync
     *
     * The next flow will be executed in host:
     * git fetch remote (being remote defined in environment config)
     * git checkout branch (being branch defined in environment config)
     * git stash if git working copy in host is "dirty"
     * git rebase remote/branch
     * git stash pop if git working copy in host was "dirty"
     *
     * @return bool
     */
Deploying using git rebase strategy instead of rsync
The next flow will be executed in host:
git fetch remote (being remote defined in environment config)
git checkout branch (being branch defined in environment config)
git stash if git working copy in host is "dirty"
git rebase remote/branch
git stash pop if git working copy in host was "dirty"

@return bool
Deploying using git rebase strategy instead of rsync The next flow will be executed in host : git fetch remote ( being remote defined in environment config ) git checkout branch ( being branch defined in environment config ) git stash if git working copy in host is " dirty " git rebase remote / branch git stash pop if git working copy in host was " dirty " @return bool
public function run()
    {
        $deploymentGitData = $this->getConfig()->environmentConfig('git-rebase-defaults', array());
        $remote = $this->getParameter('remote', (array_key_exists('remote',$deploymentGitData)) ? $deploymentGitData['remote'] : 'origin');
        $branch = $this->getParameter('branch', (array_key_exists('branch',$deploymentGitData)) ? $deploymentGitData['branch'] : 'master');
        $result = true;
        $result = $this->runCommandRemote("git fetch $remote", $output) && $result;
        if(!$result)
        {
            Console::output("<red>fails fetch $remote ... </red>",0,0);
            return false;
        }
        $result = $this->runCommandRemote("git checkout $branch") && $result;
        if(!$result)
        {
            Console::output("<red>fails $branch checkout ... </red>",0,0);
            return false;
        }
        $status = '';
        $result = $this->runCommandRemote('git status --porcelain', $status) && $result;
        $clean = (empty($status)) ? true : false;
        $stashed = false;
        if(!$clean)
        {
            $result = $this->runCommandRemote("git stash", $output) && $result;
            if($output != "No local changes to save"){
                Console::output("stash ... ",0,0);
                $stashed = true;
            }
        }
        $result = $this->runCommandRemote("git rebase $remote/$branch", $output) && $result;
        if(!$result)
        {
            Console::output("<red>fails rebase $remote/$branch ... </red>",0,0);
        }
        if($stashed)
        {
            $result = $this->runCommandRemote("git stash pop", $output) && $result;
            Console::output("stash pop ... ",0,0);
        }
        return $result;
    }
public function run ( ) { $ deploymentGitData = $ this -> getConfig ( ) -> environmentConfig ( 'git-rebase-defaults' , array ( ) ) ; $ remote = $ this -> getParameter ( 'remote' , ( array_key_exists ( 'remote' , $ deploymentGitData ) ) ? $ deploymentGitData [ 'remote' ] : 'origin' ) ; $ branch = $ this -> getParameter ( 'branch' , ( array_key_exists ( 'branch' , $ deploymentGitData ) ) ? $ deploymentGitData [ 'branch' ] : 'master' ) ; $ result = true ; $ result = $ this -> runCommandRemote ( " git fetch  $ remote " , $ output ) && $ result ; if ( ! $ result ) { Console :: output ( " <red>fails fetch  $ remote  ... </red> " , 0 , 0 ) ; return false ; } $ result = $ this -> runCommandRemote ( " git checkout  $ branch " ) && $ result ; if ( ! $ result ) { Console :: output ( " <red>fails  $ branch  checkout ... </red> " , 0 , 0 ) ; return false ; } $ status = '' ; $ result = $ this -> runCommandRemote ( 'git status --porcelain' , $ status ) && $ result ; $ clean = ( empty ( $ status ) ) ? true : false ; $ stashed = false ; if ( ! $ clean ) { $ result = $ this -> runCommandRemote ( " git stash " , $ output ) && $ result ; if ( $ output != " No local changes to save " ) { Console :: output ( " stash ...  " , 0 , 0 ) ; $ stashed = true ; } } $ result = $ this -> runCommandRemote ( " git rebase  $ remote / $ branch " , $ output ) && $ result ; if ( ! $ result ) { Console :: output ( " <red>fails rebase  $ remote / $ branch  ... </red> " , 0 , 0 ) ; } if ( $ stashed ) { $ result = $ this -> runCommandRemote ( " git stash pop " , $ output ) && $ result ; Console :: output ( " stash pop ...  " , 0 , 0 ) ; } return $ result ; }
Deploying using git rebase strategy instead of rsync
 The next flow will be executed in host:
 git fetch remote (being remote defined in environment config)
 git checkout branch (being branch defined in environment config)
 git stash if git working copy in host is "dirty"
 git rebase remote/branch
 git stash pop if git working copy in host was "dirty"
Deploying using git rebase strategy instead of rsync The next flow will be executed in host : git fetch remote ( being remote defined in environment config ) git checkout branch ( being branch defined in environment config ) git stash if git working copy in host is " dirty " git rebase remote / branch git stash pop if git working copy in host was " dirty "
//config from params, and if not params from environment config: git-rebase-defaults //fetching //ensuring right branch is checked out //testing for local modifications just to be sure //hacemos un stash //rebasing //local modifications before rebase being popped from stash