If I am working not on my primary PC I sometimes forget to push commits to the origin remote. Therefore next day I am in company I miss commits that are local on the other PC. To avoid that problem I wrote a git-hook that pushes every commit instantly to the origin-remote.
For this you need to create the file post-commit with following content
#!/bin/sh #With this git-hook every commit is immeditely pushed to origin branch=$(git rev-parse --abbrev-ref HEAD) echo Pushing commit to origin/$branch git push -u origin $branch
Save the file to the .git\hooks directory. Now after each git commit the commit is pushed to the remote.