-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Gitflow and callbacks #171
Comments
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. |
This would be a great addition to git-flow!! |
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. |
Alright then, 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. Quick info
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. IssuesIf you find any issues please submit them here: https://github.com/petervanderdoes/gitflow/issues |
I think .gitflow is the best option, it would be great if you could put these scripts in the repository! How can I test this branch, and reinstall the original Git Flow afterwards? |
Steps
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
|
I'll be rewriting this based on another patch I wrote, #184 Feature/separate gitflow config directory and file That patch does not let you set your own main dir, it's hardcoded, basically like git itself. |
i'd prefer it to be hardcoded, personally. |
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:
|
Renames the called hooks to new proposed naming convention. Removes the configurable configuration/hooks directory. All hooks are to be stored in .git/hooks Signed-off-by: Peter van der Does <[email protected]>
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. |
Renames the called hooks to new proposed naming convention. Removes the configurable configuration/hooks directory. All hooks are to be stored in .git/hooks Signed-off-by: Peter van der Does <[email protected]> Signed-off-by: Vincent Driessen <[email protected]>
Is there a git flow command that takes you back to the develop branch, other than git checkout develop? |
I believe I implemented all hooks as described. |
+1 |
1 similar comment
+1 |
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. |
+1 |
The hooks are implemented in my fork, on the develop branch. https://github.com/petervanderdoes/gitflow |
Thanks! Have to test that one. I think this is so great feature that this should be added to gitflow. |
+1 |
+1 PLEASE! |
+1 |
1 similar comment
+1 |
+1 |
+2 ;-) |
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. |
Why this feature is still not available in |
It seems the project is no longer maintained. |
@petervanderdoes, it appears so. Any issues found when moving to your fork? If this repo isn't going to be maintained, I'll move over to yours; I just want to make sure I don't create issues on my end by moving. =D |
Non that I heard of. |
Is this ever going to be merged? It was be really nice for our workflow if we could hook into git-flow . We've build some code that makes cards in pivotal. |
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:
.git/hooks
post-(first command)-(second command)
. i.e.:post-feature-start
pre-(first command)-(second command)
. i.e.:pre-feature-start
arguments: the arguments specified on the command line to git flow
(git flow feature start login_screen would pass login screen)
If a pre script returns non-0 exit code, git flow command aborts.
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)
Prior Art
This has been discussed briefly in the community before (Git specific hooks: #60)
Some people that might be interested in this
Some people that might be interested in this (having used Git flow with them on projects in the past): @saturnflyer, @bokmann (Dave Bock, of the git flow screencast fame)
The text was updated successfully, but these errors were encountered: