Join GitHub today
RFC: Gitflow and callbacks #171
It would be great to be able to write hook scripts, or callbacks, to be executed before and/or after git flow commits. Essentially: git hooks for git flow.
User stories for git flow callbacks:
How they could work:
Alternatives to storing in .git/hooks:
.git/hooks is the standard place for holding git hooks. This has the advantage that it is standardized, and the disadvantage that this folder is not under version control. Although, if a team has defined standard git hooks before, they know how to handle this.
We could also define our own folder: .git_flow/hooks for this purpose. Which you could then store in version control and not have to deal with (copying files from version control into .git/hooks)
This has been discussed briefly in the community before (Git specific hooks: #60)
Some people that might be interested in this
I really like the idea of the hooks. I was looking for something like that when I was trying to force the timings issue.
The biggest roadblock for me was going from feature back to develop, as there isn't a 'git flow' command to do this. I just use git checkout develop.
The main question to determine is where the hook script will be stored.
My personal believe is to use the gitconfig solution with a default as .gitflow
This would create a directory structure:
I agree with the naming convention and how they could work.
I just published a fork of gitflow that implements hooks. I haven't written documentation yet, besides a bit in the code itself. What it comes down to is that for every command, there is a pre and post hook you can write.
You can find the feature branch here: https://github.com/petervanderdoes/gitflow/tree/feature/implent_hooks
So I would say test away, this is an active coding branch so thing might break every now and then.
If you find any issues please submit them here: https://github.com/petervanderdoes/gitflow/issues
and that's it. You can write your own hooks as described above.
To return to the original gitflow files:
To return your project's git repo to pristine state
As the #184 is hard coded nothing will change in that matter. Besides the proposed action scripts, I'm thinking about adding filter scripts as well.
Example of a filter script
Another example could be that the project needs to have a current date prefix:
OK, I've read a lot of the discussion here and took a look at some of the patches that are proposed. I definitely see a justification for the "hooks" feature, but I'd like it to be intuitive, adhere to existing standards and be simple even without documentation.
This is very close, if not identical, to @rwilcox's proposal.
Let me elaborate on how I'd like it:
So what about this proposal?
An exhaustive list of 26 useful hook scripts:
Jan 2, 2012
I renamed the feature/implent_hooks to feature/implement-hooks (the typo was driving me nuts :) ) and made changes reflecting nvie's proposal.
Features not implemented yet are the calling of the hooks with parameters and currently a hook can be called for every command available. Opening a pull request in a second.
added a commit
Jan 2, 2012
Really looking forward to this so I can get proper bug system integration.
feature finish will automatically mark commits tagged with 'Ticket #123' as Resolved.
release start will plug the version number into the bug system and allow tickets to be filed against that release
This will greatly help developers, QA, and support staff figure out which pieces of functionality are being impacted at any given time.
This was referenced
Oct 18, 2012
Is there any progress with that? We really have a need for hooks in git-flow to ease things and would like to avoid working with a fork.
Apart from that, I have some comments in regard to the configurability of the hookdir. As @nvie stated, he'd prefer to use a fixed location for the hook dir (path by convention). I think, a configurable path as it used to be in the previous patch of @petervanderdoes would be way better, since:
Please reconsider re-adding support and merging it.
I know you say you don't want to work with a fork but this has been open for 2 years now. I highly doubt it will be implemented here.
Besides the configurable hook dir, this is implemented in my fork git-flow (AVH Edition)
Checkout the changelog for more information about bugfixes and new features implemented in my fork.