sweetchuck / git
Git related helpers classes.
Installs: 0
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/sweetchuck/git
Requires
- php: >=8.3
- ext-mbstring: *
- symfony/filesystem: ^7.2
Requires (Dev)
- ext-dom: *
- ext-json: *
- nuvoleweb/robo-config: ^3.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.1
- phpstan/phpstan-phpunit: ^2.0
- phpunit/phpunit: ^11.0
- squizlabs/php_codesniffer: ^3.5
- sweetchuck/git-hooks: 2.x-dev
- sweetchuck/robo-git: 4.x-dev
- sweetchuck/robo-phpcs: 4.x-dev
- sweetchuck/robo-phpstan: 3.x-dev
- symfony/error-handler: ^7.0
This package is auto-updated.
Last update: 2025-10-12 14:35:10 UTC
README
Commands
Why use this package instead of \exec()?
Using these commands instead of directly calling \exec() offers several advantages:
- Structured data handling
Results are parsed into PHP arrays and objects, making them easier to work with than raw command output.
Supported commands
- start a working area
- ✔
git init - ✔
git clone
- ✔
- work on the current change
- ✔
git add - ✔
git mv - ✔
git restore - ✔
git rm - 🛠
git apply -- <paths> - 🛠
git apply --stat - 🛠
git apply --numstat - 🛠
git apply --sumary - 🛠
git apply --check - 🛠
git stash- 🛠
git stash list - 🛠
git stash show - 🛠
git stash drop - 🛠
git stash pop - 🛠
git stash apply - 🛠
git stash branch - 🛠
git stash push - 🛠
git stash save - 🛠
git stash clear - 🛠
git stash create - 🛠
git stash store - 🛠
git stash export - 🛠
git stash import
- 🛠
- ✔
- examine the history and state
- 🛠
git bisect - 🛠
git diff-tree --patch - 🛠
git diff-tree --stat - 🛠
git diff-tree --compact-summary - 🛠
git diff-tree --numstat - 🛠
git diff-tree --shortstat - 🛠
git diff-tree --dirstat - 🛠
git diff-tree --summary - 🛠
git diff-tree -S<pattern> - 🛠
git diff-tree -G<pattern> - 🛠
git diff - ✔
git diff --name-status --cached - ✔
git diff --name-status(without--cached) - ✔
git grep - 🛠
git log- ✔
git log --name-status(src/Command/GetCommits.php) - 🛠
git log --full-diff - 🛠
git log -L<start>,<end>:<file> - 🛠
git log -L:<funcname>:<file>
- ✔
- 🛠
git show- ✔
git show [ref]:<filePath>(src/Command/GetFileContent.php)
- ✔
- ✔
git status - ✔
git ls-files - ✔
git ls-tree - ✔
git check-ignore - ✔
git check-attr
- 🛠
- grow, mark and tweak your common history
- 🛠
git backfill - ✔
git branch CREATE - ✔
git branch --list --verbose - ✔
git branch --move - ✔
git branch --set-upstream-to - ✔
git branch --delete - ✔
git commit - ✔
git merge - ✔
git rebase - ✔
git reset - 🛠
git checkout - ✔
git symbolic-ref <name> <ref>UpsertSymbolicRef - ✔
git symbolic-ref <name>ReadSymbolicRef - ✔
git symbolic-ref --delete <name>DeleteSymbolicRef - ✔
git switch - ✔
git tag CREATE - ✔
git tag --list --verbose - ✔
git tag --delete
- 🛠
- collaborate
- 🛠
git remote- ✔
git remote --verbose - ✔
git remote add - ✔
git remote rename - ✔
git remote remove - ✔
git remote update - ✔
git remote get-urlFetch, Push - ✔
git remote set-urlSet, Add, Delete - ✔
git remote prune - ✔
git remote set-branches - 🛠
git remote set-head - 🛠
git remote show
- ✔
- ✔
git fetch - ✔
git pull - ✔
git push
- 🛠
- config
- ✔
git config list - ✔
git config get - ✔
git config set - ✔
git config unset
- ✔
- other
- ✔
git --version - ✔
git --exec-path - 🛠
git fmt-merge-msg - 🛠 and a lot of other commands
- ✔
stdInput reader
stdInput reader - Supported Git hooks
stdInput reader - Usage
.git/hooks/pre-receive
#!/usr/bin/env php <?php use Sweetchuck\Git\StdInputReader\PreReceiveReader; $reader = new PreReceiveReader(\STDIN); foreach ($reader as $item) { echo 'Old value: ', $item->oldValue, \PHP_EOL; echo 'New value: ', $item->newValue, \PHP_EOL; echo 'Ref name: ', $item->refName, \PHP_EOL; echo '-----------', \PHP_EOL; }