summaryrefslogtreecommitdiffstats
path: root/src/GitHubPagesDeploy/GitHubPagesDeploy.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/GitHubPagesDeploy/GitHubPagesDeploy.php')
-rw-r--r--src/GitHubPagesDeploy/GitHubPagesDeploy.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/GitHubPagesDeploy/GitHubPagesDeploy.php b/src/GitHubPagesDeploy/GitHubPagesDeploy.php
index 34c31d4..bcf2fde 100644
--- a/src/GitHubPagesDeploy/GitHubPagesDeploy.php
+++ b/src/GitHubPagesDeploy/GitHubPagesDeploy.php
@@ -33,6 +33,7 @@ class GitHubPagesDeploy
$wrapper->streamOutput();
foreach ($this->repositories as $dir => $repo) {
+ // Build our git interface.
$git = null;
if (!is_dir($dir)) {
$git = $wrapper->cloneRepository($repo, $dir);
@@ -41,17 +42,20 @@ class GitHubPagesDeploy
$git = new GitWorkingCopy($wrapper, $dir);
}
+ // Fetch all the latest.
+ $git->fetch('--all');
+
// Remove any local changes.
$git->reset(array('hard' => true));
+ // Clean up the repository.
+ $git->run(array('clean', array('d' => TRUE, 'f' => TRUE)));
+
// Ensure we are on the correct branch.
- $git->checkout('gh-pages');
+ $git->checkout('gh-pages', array('force' => TRUE));
- // Pull in any changes.
+ // Finally, pull in the changes.
$git->pull();
-
- // Ensure there aren't any local changes.
- $git->reset(array('hard' => true));
}
}