GitWrapper\GitWorkingCopy::reset PHP Method

reset() public method

Reset current HEAD to the specified state.
public reset ( ) : GitWorkingCopy
return GitWorkingCopy
    public function reset()
    {
        $args = func_get_args();
        array_unshift($args, 'reset');
        return $this->run($args);
    }

Usage Example

Beispiel #1
0
 public function deploy()
 {
     // Create the wrapper.
     $wrapper = new GitWrapper();
     $wrapper->streamOutput();
     // Iterate through each project.
     foreach ($this->projects as $name => $project) {
         // Check out all branches.
         foreach ($project['branches'] as $branch => $destination) {
             // Build our git interface.
             $git = null;
             if (!is_dir($destination)) {
                 $git = $wrapper->cloneRepository($project['repo'], $destination);
             } else {
                 $git = new GitWorkingCopy($wrapper, $destination);
             }
             // Fetch the latest.
             $git->fetch('origin');
             // Checkout the desired branch.
             $git->checkout($branch, array('force' => true));
             // Reset any local changes.
             $git->reset(array('hard' => true));
             // Pull the latest from the branch.
             $git->pull('origin', $branch, array('force' => true));
         }
     }
 }
All Usage Examples Of GitWrapper\GitWorkingCopy::reset