diff --git a/readme.md b/readme.md index 02c34b2..38b4ac6 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,5 @@ Git-PHP -============ +======= Library for work with Git repository in PHP. @@ -9,12 +9,12 @@ Usage ``` php addFile($filename); $repo->commit('init commit'); @@ -23,6 +23,104 @@ Usage [API documentation](http://api.iunas.cz/git-php/) +Initialization of empty repository +---------------------------------- + +``` php +isChanges(); +$repo->commit('commit message'); +$repo->merge('branch-name'); +$repo->checkout('master'); + +$repo->getRepositoryPath(); + +// adds files into commit +$repo->addFile('file.txt'); +$repo->addFile('file1.txt', 'file2.txt'); +$repo->addFile(array('file3.txt', 'file4.txt')); + +// renames files in repository +$repo->renameFile('old.txt', 'new.txt'); +$repo->renameFile(array( + 'old1.txt' => 'new1.txt', + 'old2.txt' => 'new2.txt', +)); + +// removes files from repository +$repo->removeFile('file.txt'); +$repo->removeFile('file1.txt', 'file2.txt'); +$repo->removeFile(array('file3.txt', 'file4.txt')); +``` + + + +Manipulation with branches +-------------------------- + +``` php +getBranches(); + +// gets list of all local branches +$repo->getLocalBranches(); + +// gets name of current branch +$repo->getCurrentBranchName(); + +// creates new branch +$repo->createBranch('new-branch'); + +// creates new branch and checkout +$repo->createBranch('patch-1', TRUE); + +// removes branch +$repo->removeBranch('branch-name'); +``` + + +Manipulation with tags +-------------------------- + +``` php +getTags(); + +// creates new tag +$repo->createTag('v1.0.0'); + +// renames tag +$repo->renameTag('old-tag', 'new-tag'); + +// removes tag +$repo->removeTag('tag-name'); +``` + + Installation ------------ @@ -36,3 +134,4 @@ composer require czproject/git-php License: [New BSD License](license.md)
Author: Jan Pecha, http://janpecha.iunas.cz/ +