PHPackages                             autoframe/git-exec-hook - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. autoframe/git-exec-hook

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

autoframe/git-exec-hook
=======================

Http git hook call for action for fetch pull checkout commit push

1.0.1(1y ago)013MITPHPPHP &gt;=7.4

Since Aug 10Pushed 1y ago1 watchersCompare

[ Source](https://github.com/autoframe/git-exec-hook)[ Packagist](https://packagist.org/packages/autoframe/git-exec-hook)[ Docs](https://github.com/autoframe)[ RSS](/packages/autoframe-git-exec-hook/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

Autoframe is a low level framework that is oriented on SOLID flexibility
========================================================================

[](#autoframe-is-a-low-level-framework-that-is-oriented-on-solid-flexibility)

👨🏼‍💻 git-exec-hook
------------------

[](#‍-git-exec-hook)

[![License: The 3-Clause BSD License](https://camo.githubusercontent.com/be826c91a7553f1592dac6ccc7013f5ffe597af7f9df95f29d158c3e3e33cadf/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6175746f6672616d652f6769742d657865632d686f6f6b)](https://opensource.org/license/bsd-3-clause/)[![Packagist Version](https://camo.githubusercontent.com/7901958fe1cb102b7f9e92c00808e26bef94c7a2fefc9556f2fedb924cf4b25b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6175746f6672616d652f6769742d657865632d686f6f6b3f6c6162656c3d7061636b6167697374253230737461626c65)](https://camo.githubusercontent.com/7901958fe1cb102b7f9e92c00808e26bef94c7a2fefc9556f2fedb924cf4b25b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6175746f6672616d652f6769742d657865632d686f6f6b3f6c6162656c3d7061636b6167697374253230737461626c65)[![Downloads](https://camo.githubusercontent.com/dc69e21a29864cb86bd6dc0768533fe05753a002d017d1fb32e9139851797cd8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6175746f6672616d652f6769742d657865632d686f6f6b2e737667)](https://packagist.org/packages/autoframe/git-exec-hook)

Http git hook call for action for fetch pull checkout commit push
=================================================================

[](#http-git-hook-call-for-action-for-fetch-pull-checkout-commit-push)

*Config with constants or constructor args*

```
define('X_HUB_SIGNATURE','sha1 hook token'); //or use in AfrGitHook constructor
define('X_HUB_SIGNATURE_256','sha256 hook token'); //or use sha 256

define('X_PATH_TO_GIT_REPO_DIR','path to current repo dir'); //or use in AfrGitExec constructor
```

---

```
`AfrGitHook`

use Autoframe\GitExecHook\AfrGitHook;
use Autoframe\GitExecHook\AfrGitExec;

//Hook example
$oGhr = new AfrGitHook('HOOK_TOKEN', '', true);
$gitExec = new AfrGitExec(__DIR__ . '/origin');

//print_r($gitExec->setGitConfigDefault('autoframe','USER@gmail.com'));
//print_r($gitExec->gitCloneWithUserToken('https://github.com/autoframe/hx','USER','ghp_TOKEN'));

if ($oGhr->isPushOnMasterBranch()) {
    $aLog = $gitExec->allInOnePushCurrentThenSwitchToMasterPullAddCommitAndPush();
    echo '';
    print_r($aLog);
    echo '';
}
```

---

```
`AfrGitExec`

use Autoframe\GitExecHook\AfrGitExec;

$gitExec = new AfrGitExec('/PATH_TO_GIT_REPO_DIR');

echo '';
print_r(
    $gitExec->gitAddCommitAndPush(
        'Manual commit ' .  gmdate('Y-m-d H:i:s') . ' GMT',
        $gitExec->getCurrentBranchName()
    )
);
echo '';
```

---

🚀 git install on Cpanel / WHM 🤖
===============================

[](#-git-install-on-cpanel--whm-)

### 💻 Ubuntu

[](#-ubuntu)

```
sudo apt update
sudo apt install git
git --version

```

### 💻 CentOS 8

[](#-centos-8)

```
sudo dnf update -y
sudo dnf install git -y
git --version

```

### 💻 CentOS 7

[](#-centos-7)

```
sudo yum update
sudo yum install git
git --version

```

---

⚙️ Config
=========

[](#️-config)

### ssh / gpg / armour / fingerprint

[](#ssh--gpg--armour--fingerprint)

```
ssh-keygen -o

```

### 📚 List current config

[](#-list-current-config)

```
git config --list

```

### 🛠️ Set config globally

[](#️-set-config-globally)

```
git config --global user.name "Your Name"
git config --global user.email "you@example.com"

git config --global core.logallrefupdates true
git config --global core.autocrlf false
git config --global core.symlinks false
git config --global core.bare false
git config --global core.ignorecase true
git config --global core.eol lf

```

### 🔧 Set config to current project

[](#-set-config-to-current-project)

just ignore ***--global***

```
cd ~/some-dir/project-dir

```

🍀🌈🦄 Clone
=========

[](#-clone)

```
cd ~/some-dir/project-dir
git clone git@github.com:autoframe/xxxx.git
git clone 'https://github.com/autoframe/xxxx.git'

```

### ⛔ clone private repos

[](#-clone-private-repos)

Create a new token for the repo:

```
git clone https://user:TOKEN@github.com/autoframe/repo/
git clone https://user:TOKEN@github.com/username/repo.git
git clone https://oauth2:@github.com//.git
git clone https://@github.com//.git

```

### 📄 Afterward, you can do the following two steps to normalize all files:

[](#-afterward-you-can-do-the-following-two-steps-to-normalize-all-files)

```
git rm --cached -r .  ⚠️ Remove every file from git's index.
git reset --hard      ⚠️ Rewrite git's index to pick up all the new line endings.
git reset --hard HEAD~1 2>&1 ⚠️ Rollback commits back to head

```

---

❗⚠️ Reset commands
==================

[](#️-reset-commands)

```
git checkout .         #If you want to revert changes made to your working copy, do this:
git reset              #If you want to revert changes made to the index (i.e., that you have added), do this. Warning this will reset all of your unpushed commits to master!:
git clean -f           #If you want to remove untracked files (e.g., new files, generated files):
git clean -fd          #Or untracked directories (e.g., new or automatically generated directories):

git revert       #If you want to revert a change that you have committed, do this:

```

🌐 Read from upstream
====================

[](#-read-from-upstream)

```
git pull        #Pull branch info
git fetch       #Refresh branches

```

📥 Checkout
==========

[](#-checkout)

```
git checkout master     #Checkout master branch
git checkout -q master  #Quiet, suppress feedback messages.
git checkout -f master  #When switching branches, proceed even if the index or the working tree differs from HEAD. This is used to throw away local changes.

```

### 🙈 checkout args

[](#-checkout-args)

```
-q, --quiet

```

Quiet, suppress feedback messages.

```
-f, --force

```

When switching branches, proceed even if the index or the working tree differs from HEAD. This is used to throw away local changes.

```
-b

```

**git checkout -b new-branch-name**

Create a new branch named &lt;new\_branch&gt; and start it at &lt;start\_point&gt;; see git-branch(1) for details.

```
-m, --merge

```

When switching branches, if you have local modifications to one or more files that are different between the current branch and the branch to which you are switching, the command refuses to switch branches in order to preserve your modifications in context. However, with this option, a three-way merge between the current branch, your working tree contents, and the new branch is done, and you will be on the new branch.

```
--ours, --theirs

```

When checking out paths from the index, do not fail upon unmerged entries; instead, unmerged entries are ignored.

📤 Push
======

[](#-push)

```
git diff
git add .
git commit -m "#uztpOegQ comment info"
git commit -m "PROPT-6264 second commit"

git push
git push -u origin branch_name

```

### 🙈 push args

[](#-push-args)

```
-u, --set-upstream

```

For every branch that is up-to-date or successfully pushed, add upstream (tracking) reference, used by argument-less git-pull\[1\] and other commands.

```
-q, --quiet

```

Suppress all output, including the listing of updated refs, unless an error occurs. Progress is not reported to the standard error stream.

```
--all, --branches

```

Push all branches (i.e. refs under refs/heads/); cannot be used with other .

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

3

Last Release

641d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d6ba2f50102c2d35a8f6773c95fa270199a3af9c555dfc96ac85afb8c10a2a3c?d=identicon)[autoframe](/maintainers/autoframe)

---

Top Contributors

[![autoframe](https://avatars.githubusercontent.com/u/34517931?v=4)](https://github.com/autoframe "autoframe (8 commits)")

---

Tags

chehkoutcommitfetchgithookpullpushgit hookgit fetchgit pullgit checkoutgit commitgit push

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/autoframe-git-exec-hook/health.svg)

```
[![Health](https://phpackages.com/badges/autoframe-git-exec-hook/health.svg)](https://phpackages.com/packages/autoframe-git-exec-hook)
```

###  Alternatives

[yireo/magento2-googletagmanager2

Add Google Tag Manager to Magento

167930.4k5](/packages/yireo-magento2-googletagmanager2)[wcm/git-php-hooks

Write git hooks with PHP, organize them on a per-project base and automatically add them

6441.1k3](/packages/wcm-git-php-hooks)[wcm/git-php-hooks-library

A collection of Git PHP Hooks

1210.1k3](/packages/wcm-git-php-hooks-library)[yaroslawww/laravel-force-https

Easy redirect to https for Laravel.

139.7k](/packages/yaroslawww-laravel-force-https)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
