How can I automatically deploy my app after a git push ( GitHub and node.js)?

Example in PHP: Navigate to github into your github repository add click “Admin” click tab ‘Service Hooks’ => ‘WebHook URLs’ and add http://your-domain-name/git_test.php then create git_test.php <?php try { $payload = json_decode($_REQUEST[‘payload’]); } catch(Exception $e) { exit(0); } //log the request file_put_contents(‘logs/github.txt’, print_r($payload, TRUE), FILE_APPEND); if ($payload->ref === ‘refs/heads/master’) { // path to your site … Read more

Remove refs/original/heads/master from git repo after filter-branch –tree-filter?

refs/original/* is there as a backup, in case you mess up your filter-branch. Believe me, it’s a really good idea. Once you’ve inspected the results, and you’re very confident that you have what you want, you can remove the backed up ref: git update-ref -d refs/original/refs/heads/master or if you did this to many refs, and … Read more

How to find the commit in which a given file was added?

Here’s simpler, “pure Git” way to do it, with no pipeline needed: git log –diff-filter=A — foo.js Check the documentation. You can do the same thing for Deleted, Modified, etc. https://git-scm.com/docs/git-log#Documentation/git-log.txt—diff-filterACDMRTUXB82308203 I have a handy alias for this, because I always forget it: git config –global alias.whatadded ‘log –diff-filter=A’ This makes it as simple as: … Read more

Checking for a dirty index or untracked files with Git

The key to reliably “scripting” Git is to use the ‘plumbing’ commands. The developers take care when changing the plumbing commands to make sure they provide very stable interfaces (i.e. a given combination of repository state, stdin, command line options, arguments, etc. will produce the same output in all versions of Git where the command/option … Read more

Export only modified and added files with folder structure in Git

git diff-tree -r –no-commit-id –name-only –diff-filter=ACMRT $commit_id git diff-tree -r $commit_id: Take a diff of the given commit to its parent(s) (including all subdirectories, not just the top directory). –no-commit-id –name-only: Do not output the commit SHA1. Output only the names of the affected files instead of a full diff. –diff-filter=ACMRT: Only show files added, … Read more