Skip to content

Instantly share code, notes, and snippets.

@pdbartsch
Last active July 9, 2018 23:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pdbartsch/bc23380333667565c10072b27ce70e40 to your computer and use it in GitHub Desktop.
Save pdbartsch/bc23380333667565c10072b27ce70e40 to your computer and use it in GitHub Desktop.
git hooks

question:

When using VS Code I often forget to push changes after a commit. Any extensions or hacks to just push with each commit?

answer

git hooks

The hooks are all stored in the hooks subdirectory of the Git directory. In most projects, that’s .git/hooks.

  • create an executable file called post-commit with no file extension in the hooks directory with the following 2 lines
  1. #!/bin/sh
  2. git push origin master

done

This obviously isn't always good practice but for certain private repos it can be handy

what else can be done with Git Hooks?

Let your imagination go wild

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment