---
title: Using GIT to automate your browser testing | TestingBot Blog
description: |-
  If you're looking for a way to run tests after each git commit push, you can use the post-commit hook supplied by GIT.


  In your repository, create...
source_url:
  html: https://testingbot.com/blog/2015/05/20/using-git-to-automate-your-browser-testing
  md: https://testingbot.com/blog/2015/05/20/using-git-to-automate-your-browser-testing.md
---

# Git hook for Selenium

By [Jochen D.](https://testingbot.com/about/jochen-d)2015-05-20

 Share on Facebook 

 Share on Twitter 

 Post on Reddit 

 Share link 

If you're looking for a way to run tests after each git commit push, you can use the `post-commit` hook supplied by GIT.

In your repository, create a post-commit file:

`vim .git/hooks/post-commit`

In this file you can for example add a cURL call which will [start all your browser tests at TestingBot via API](https://testingbot.com/support/api#testjob). `curl -u key:secret https://api.testingbot.com/v1/lab/trigger_all -X POST -d ""`

Optionally, you can specify an [API callback URL](https://testingbot.com/support/api#apicallback) at TestingBot, which will be called when all tests are finished. Our API will call your URL and supply the test results in JSON format.

If you only want to do this for a specific branch, you can use this snippet:

```bash
#!/bin/bash
while read oldrev newrev refname
do
    branch=$(git rev-parse --symbolic --abbrev-ref $refname)
    if ["master" == "$branch"]; then
        # Do something
    fi
done
```

Tip: you can also use `pre-push` or `post-receive` hooks, depending on when in the GIT process you'd like to run your tests.

[← Previous post Keeping our Selenium VMs up to date](https://testingbot.com/blog/2015/05/17/keeping-our-selenium-vms-up-to-date) [Next post → TestLab: customize e-mail alert & receive recover alerts](https://testingbot.com/blog/2015/05/29/testlab-customize-e-mail-alert-receive-recover-alerts)

## Sidebar

### TestingBot Cloud Testing

Run automated, manual and visual tests on remote browsers and devices. Sign up for a free trial.

[Free Trial](https://testingbot.com/users/sign_up)

### Latest articles

[![Announcing AI Test Insights](https://testingbot.com/assets/blog/2026/ai-insights.jpg)](https://testingbot.com/blog/ai-test-insights)

#### Announcing AI Test Insights

Use AI Insights to quickly discover why an automated test...

[Read: Announcing AI Test Insights](https://testingbot.com/blog/ai-test-insights)

[![Selenium vs Playwright 2026](https://testingbot.com/assets/blog/2026/selenium-vs-playwright-2026.jpg)](https://testingbot.com/blog/selenium-vs-playwright)

#### Selenium vs Playwright 2026

Comparing Selenium vs Playwright - which is the best test...

[Read: Selenium vs Playwright 2026](https://testingbot.com/blog/selenium-vs-playwright)

[![Maestro Physical Device Testing](https://testingbot.com/assets/blog/2026/maestro-physical.jpg)](https://testingbot.com/blog/maestro-physical-device-testing)

#### Maestro Physical Device Testing

Maestro testing in parallel on physical Android and iOS d...

[Read: Maestro Physical Device Testing](https://testingbot.com/blog/maestro-physical-device-testing)

## Related Articles

[![Announcing AI Test Insights](https://testingbot.com/assets/blog/2026/ai-insights.jpg)](https://testingbot.com/blog/ai-test-insights "Announcing AI Test Insights")

### [Announcing AI Test Insights](https://testingbot.com/blog/ai-test-insights)

Use AI Insights to quickly discover why an automated test failed.

[Read article →](https://testingbot.com/blog/ai-test-insights)

[![Selenium vs Playwright 2026](https://testingbot.com/assets/blog/2026/selenium-vs-playwright-2026.jpg)](https://testingbot.com/blog/selenium-vs-playwright "Selenium vs Playwright 2026")

### [Selenium vs Playwright 2026](https://testingbot.com/blog/selenium-vs-playwright)

Comparing Selenium vs Playwright - which is the best test framework for your usecase?

[Read article →](https://testingbot.com/blog/selenium-vs-playwright)

[![Selenium 20th birthday](https://testingbot.com/assets/blog/2024/selenium20.webp)](https://testingbot.com/blog/selenium-20-years "Selenium 20th birthday")

### [Selenium 20th birthday](https://testingbot.com/blog/selenium-20-years)

Celebrate Selenium's 20th birthday. An overview of the years.

[Read article →](https://testingbot.com/blog/selenium-20-years)

[![Selenium WebDriver BiDi](https://testingbot.com/assets/blog/2024/bidi.webp)](https://testingbot.com/blog/webdriver-bidi "Selenium WebDriver BiDi")

### [Selenium WebDriver BiDi](https://testingbot.com/blog/webdriver-bidi)

WebDriver BiDi support is now available on TestingBot. Learn how to use this exciting new improvement with your Selenium tests.

[Read article →](https://testingbot.com/blog/webdriver-bidi)

## More by Jochen D.

[![Announcing AI Test Insights](https://testingbot.com/assets/blog/2026/ai-insights.jpg)](https://testingbot.com/blog/ai-test-insights "Announcing AI Test Insights")
### [Announcing AI Test Insights](https://testingbot.com/blog/ai-test-insights)

Use AI Insights to quickly discover why an automated test failed.

[![Maestro Physical Device Testing](https://testingbot.com/assets/blog/2026/maestro-physical.jpg)](https://testingbot.com/blog/maestro-physical-device-testing "Maestro Physical Device Testing")
### [Maestro Physical Device Testing](https://testingbot.com/blog/maestro-physical-device-testing)

Maestro testing in parallel on physical Android and iOS devices.

[![tvOS Physical Device Testing](https://testingbot.com/assets/blog/2025/appletv.jpg)](https://testingbot.com/blog/tvos-automated-testing "tvOS Physical Device Testing")
### [tvOS Physical Device Testing](https://testingbot.com/blog/tvos-automated-testing)

Run automated tvOS tests on physical AppleTV devices.

[See all posts by Jochen D. →](https://testingbot.com/about/jochen-d)

## Ready to start testing?
[Start a free trial](https://testingbot.com/users/sign_up)
