The documentation says:
Information about what is to be pushed is provided on the hook's standard input with lines of the form:
< local ref> SP < local sha1> SP < remote ref> SP < remote sha1> LF
For instance, if the command +git push origin master:foreign+ were run the hook would receive a line like the following:
refs/heads/master 67890 refs/heads/foreign 12345
how do I access those lines in the pr-hook script?
You can import a remote Git repository in to Business Central and configure a post-commit Git hook to automatically push changes to that remote repository.
If you want to push to a remote branch with a different name than your local branch, separate the local and remote names with a colon: git push origin local-name:remote-name .
To push the branch or you can say to push the changes in the branch to the Github repo you have to run this command “git push origin <the branch name>” in our case the branch name is “main”. After pushing the changes the repo will look like and this is how you can push a branch to a remotely hosted GitHub repository.
If you want to manually run all pre-commit hooks on a repository, run pre-commit run --all-files . To run individual hooks use pre-commit run <hook_id> . The first time pre-commit runs on a file it will automatically download, install, and run the hook. Note that running a hook for the first time may be slow.
Remote branch name can be accessed using:
while read local_ref local_sha remote_ref remote_sha
do
echo $local_ref
echo $local_sha
echo $remote_ref
echo $remote_sha
done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With