From 28fa8ac2837102adb955caf2328b3c7416a01039 Mon Sep 17 00:00:00 2001 From: Paulo Ribeiro Date: Wed, 7 Feb 2018 12:06:07 -0200 Subject: [PATCH] Added method `refresh()`. --- src/GitRepository.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/GitRepository.php b/src/GitRepository.php index 5b959da..6a13035 100644 --- a/src/GitRepository.php +++ b/src/GitRepository.php @@ -489,6 +489,20 @@ public function setRemoteUrl($name, $url, array $params = NULL) ->end(); } + /** + * Refresh working tree index. + * Looks at the current index and checks to see if merges or updates are needed by + * checking stat() information. Useful when you want to make sure git all the latest + * changes will appear in the git status. + * @return self + */ + public function refresh() + { + return $this->begin() + ->run('git update-index -q --refresh') + ->end(); + } + /** * @return self