From 22e1786885d37fc73482d28133e4b03dd42fb250 Mon Sep 17 00:00:00 2001 From: Gerry Demaret Date: Wed, 20 Apr 2016 09:00:45 +0200 Subject: [PATCH] IGit, GitRepository: add missing push() (#3) --- src/GitRepository.php | 20 ++++++++++++++++++++ src/IGit.php | 10 ++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/GitRepository.php b/src/GitRepository.php index 1064645..820322d 100644 --- a/src/GitRepository.php +++ b/src/GitRepository.php @@ -409,6 +409,26 @@ public function pull($remote = NULL, array $params = NULL) } + /** + * Push changes to a remote + * @param string|NULL + * @param array|NULL + * @return self + * @throws GitException + */ + public function push($remote = NULL, array $params = NULL) + { + if(!is_array($params)) + { + $params = array(); + } + + return $this->begin() + ->run("git push $remote", $params) + ->end(); + } + + /** * @param string * @param callback|NULL diff --git a/src/IGit.php b/src/IGit.php index cb44800..00cfcf4 100644 --- a/src/IGit.php +++ b/src/IGit.php @@ -149,6 +149,16 @@ function hasChanges(); function pull($remote = NULL, array $params = NULL); + /** + * Push changes to a remote + * @param string|NULL + * @param array|NULL + * @return self + * @throws GitException + */ + function push($remote = NULL, array $params = NULL); + + /** * Init repo in directory * @param string