Skip to content

Commit

Permalink
GitRepository, IGit: added method addAllChanges()
Browse files Browse the repository at this point in the history
  • Loading branch information
janpecha committed Nov 18, 2016
1 parent 18239c8 commit 0a64307
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ $repo->renameFile(array(
$repo->removeFile('file.txt');
$repo->removeFile('file1.txt', 'file2.txt');
$repo->removeFile(array('file3.txt', 'file4.txt'));

// adds all changes in repository
$repo->addAllChanges();
```


Expand Down
14 changes: 14 additions & 0 deletions src/GitRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,20 @@ public function addFile($file)
}


/**
* Adds all created, modified & removed files.
* `git add --all`
* @throws Cz\Git\GitException
* @return self
*/
public function addAllChanges()
{
return $this->begin()
->run('git add --all')
->end();
}


/**
* Renames file(s).
* `git mv <file>`
Expand Down
7 changes: 7 additions & 0 deletions src/IGit.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ function removeFile($file);
function addFile($file);


/**
* Adds all created, modified & removed files.
* @throws Cz\Git\GitException
*/
function addAllChanges();


/**
* Renames file(s).
* @param string|string[] from: array('from' => 'to', ...) || (from, to)
Expand Down

0 comments on commit 0a64307

Please sign in to comment.