
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Installs a post-commit hook which helps split your work into multiple branches and PRs.
This is a git post-commit hook which cherry-picks the new commit into another branch, conditionally creating the branch and optionally making a PR as well.
This makes it pretty easy to rapidly develop multiple independent features and split them up into branches and pull-requests.
This hook is currently unstable and highly experimental. There are various untested edge cases and some circumstance might make you lost and confused in your repo.
It does not (knowingly) run hard resets or other commands where you can permanently lose data. But none-the-less, please do not use this unless you have read the source code and are comfortable with your git knowledge. The reflog especially might come in handy.
The idea is to increase throughput on projects with PRs and code-reviews. Especially where PRs need to be small, focused and self-contained, and reviews might take a day or more.
In high throughput development, you may be working on separate fixes and features in your working tree at the same time, and it can be painful to split them up into their own branches and pull-requests.
It can also be really annoying to always be working from an "old" master, not having all the latest fixes and improvements which are still in review.
This hook tries to simplify this workflow so you can do all your work on a single branch, where commits are automatically cherry-pick to the correct remote branch and pull-request.
There is just one soft dependency. To create github pull-requests, you first have to install and configure the hub command line tool.
Here are at least two ways to install the post-commit hook itself.
Install the git-hydra npm package globally:
npm i -g git-hydra
Then you can install the post-commit hook into a repo like this:
git hydra install
This will install the hook as a symbolic link to the npm package which you can update later.
Just move the post-commit.sh into the
.git/hooks folder of a repository.
While committing as usual, append your commit message with a line containing only "Branch: ".
If all works like it should, you won't notice a difference in your working tree, but the new commit has been committed to the specified branch as well. If it didn't exist already, it does now, created from master.
If you end the message with "Push: " instead, the target branch will additionally be pushed to the remote and if you do "PR: ", a pull-request will be created on github.
It's recommended to create a local development branch which you can customise to your liking by merging in active branches and pull-requests. You should never push this branch.
On this branch you can crunch commits, splitting them into different pull-requests. The github client provides an excellent UI for selecting hunks and lines to commit. As long as they changes are fairly independent everything should be beautiful.
When master has been updated enough, you can start again by recreating the local branch from master, and merge all active pull-requests again.
The matcher is case insensitive and the colon is optional. E.g. you can end your commit message with "branch ".
If the commit conflicts with master or the target branch, you'll end up in the target branch where you have to resolve the merge conflict.
After doing so, you can go back to the branch you came from. If you
are missing changes from your working tree, run git stash pop and
they should be back
If you forget to annotate where a commit should go, you can amend it's commit message and it will go where it should. It's also possible to undo and recommit it in the github application.
FAQs
Installs a post-commit hook which helps split your work into multiple branches and PRs.
The npm package git-hydra receives a total of 4 weekly downloads. As such, git-hydra popularity was classified as not popular.
We found that git-hydra demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.