sweetchuck / git
Git related helpers classes.
1.x-dev
2025-08-31 20:11 UTC
Requires
- php: >=8.3
- 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-08-31 20:12:57 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
- 🛠
git stash
- ✔
- examine the history and state
- 🛠
git bisect
- 🛠
git diff
- ✔
git diff --name-status --cached
- ✔
git diff --name-status
(without--cached
) - 🛠
git grep
- 🛠
git log
- 🛠
git show
- ✔
git status
- ✔
git ls-files
- 🛠
git check-ignore
- 🛠
- grow, mark and tweak your common history
- 🛠
git backfill
- ✔
git branch CREATE
- ✔
git branch --list --verbose
- 🛠
git branch MOVE
- 🛠
git branch SET-UPSTREAM
- 🛠
git branch GET-UPSTREAM
- ✔
git branch --delete
- ✔
git commit
- 🛠
git merge
- 🛠
git rebase
- 🛠
git reset
- 🛠
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 prune
- 🛠
git remote set-head
- 🛠
git remote set-branches
- 🛠
git remote get-url
- 🛠
git remote set-url
- 🛠
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
- 🛠 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; }