i-konov
i-konov

Reputation: 874

How to find out the contents of a git push

I was wandering if there is a way to see what exactly was included in a given push. I am looking for things like commits and also the push metadata.

Upvotes: 2

Views: 51

Answers (1)

CodeWizard
CodeWizard

Reputation: 142164

Yep, You can use hooks to find out the content of the commit content with git hooks. You can use the pre-receive or post-receive hooks

pre-receive/post-receive

#!/bin/sh


# assuming this is not teh first commit. it it is you will have to add extra lines of code
# Check to see if we have updated the given file

# the content can be grabbed using this command: 
if [ $(git diff-tree -r --name-only HEAD^1)  ];

    # Output colors
    red='\033[0;31m';
    green='\033[0;32m';
    yellow='\033[0;33m';
    default='\033[0;m';

    # personal touch :-)
    echo "${red}"
    echo "                                         "
    echo "                   |ZZzzz                "
    echo "                   |                     "
    echo "                   |                     "
    echo "      |ZZzzz      /^\            |ZZzzz  "
    echo "      |          |~~~|           |       "
    echo "      |        |-     -|        / \      "
    echo "     /^\       |[]+    |       |^^^|     "
    echo "  |^^^^^^^|    |    +[]|       |   |     "
    echo "  |    +[]|/\/\/\/\^/\/\/\/\/|^^^^^^^|   "
    echo "  |+[]+   |~~~~~~~~~~~~~~~~~~|    +[]|   "
    echo "  |       |  []   /^\   []   |+[]+   |   "
    echo "  |   +[]+|  []  || ||  []   |   +[]+|   "
    echo "  |[]+    |      || ||       |[]+    |   "
    echo "  |_______|------------------|_______|   "
    echo "                                         "
    echo "                                         "
    echo "      ${green}You have just committed code  " 
    echo "                                         "
    echo "${default}"

Upvotes: 1

Related Questions