-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Working with Git branches
Note
|
This project uses the same approach as the Spring Boot project, check its Working with Git branches page for more details. |
We use a couple of Git commit hooks to automatically create issues when merging fixes forwards. The hooks can be found in the root of the repository at git/hooks/
. To be able to use the hooks they need to be symlinked into .git/hooks
:
$ cd .git/hooks $ ln -s ../../git/hooks/forward-merge commit-msg $ ln -s ../../git/hooks/prepare-forward-merge prepare-commit-msg
Note
|
To allow Git to find the hook, the symlink must be created from the .git/hooks directory using a relative path.
|
When using git worktrees to manage multiple branches, .git
in the repository root is a file instead of a directory. In a worktree directory, create an alternate hooks directory for the symlinks and configure git to use it instead of .git/hooks
:
$ mkdir .git-hooks $ cd .git-hooks $ ln -s ../git/hooks/forward-merge commit-msg $ ln -s ../git/hooks/prepare-forward-merge prepare-commit-msg $ git config core.hooksPath ./.git-hooks
The forward-merge hook uses a file, ~/.spring-initializr/forward-merge.yml
, as the source of the GitHub credentials used to create new issues. Create the file with contents similar to the following:
github: credentials: username: your-user-id password: your-access-token
Note
|
The provided credentials should have the public_repo scope.
|
When first configuring the forward-merge hook, you may also want to set dry_run: yes
. When performing a dry run, the hook will output information to standard out about the issue that it would have created, without actually creating it.
You’re now ready to use the hook when merging changes forward.