0
0
Gitdevops~5 mins

post-merge hook in Git - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a post-merge hook in Git?
A post-merge hook is a script that runs automatically after a successful git merge. It helps automate tasks like updating dependencies or cleaning up files.
Click to reveal answer
beginner
Where do you place the post-merge hook script in a Git repository?
You place the post-merge script inside the .git/hooks/ directory of your repository, and make sure it is executable.
Click to reveal answer
beginner
What file permissions should a post-merge hook script have?
The post-merge hook script should have executable permissions, usually set with chmod +x post-merge.
Click to reveal answer
beginner
Give an example of a simple post-merge hook script that prints a message.
A simple post-merge script in Bash:<br>
#!/bin/sh
echo "Merge completed successfully!"
Click to reveal answer
beginner
Why use a post-merge hook instead of running commands manually after merging?
Using a post-merge hook automates repetitive tasks, reduces human error, and ensures important steps run every time a merge happens.
Click to reveal answer
What triggers the post-merge hook in Git?
AAfter pushing to remote
BBefore a git commit
CWhen cloning a repository
DAfter a successful git merge
Where should the post-merge hook script be located?
AInside the .git/hooks directory
BIn the root project directory
CIn the user's home directory
DIn the remote repository
Which command makes a post-merge hook script executable?
Achmod +x post-merge
Bgit enable post-merge
Cchmod 644 post-merge
Dgit hook activate post-merge
What is a common use of a post-merge hook?
ATo create a new branch
BTo update dependencies after merging
CTo push changes to remote
DTo delete the repository
Can the post-merge hook run on a remote server automatically?
AOnly if configured in the remote repo
BYes, always on remote servers
CNo, it runs only on the local machine
DOnly during git push
Explain what a post-merge hook is and describe a simple task it can automate.
Think about what happens right after you combine code changes.
You got /3 concepts.
    Describe how to set up a post-merge hook script in a Git repository.
    Focus on where the script goes and what permissions it needs.
    You got /3 concepts.