Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Log all committed file

Hi,

Was wondering how could I log, on the output, all the files and paths that were committed using the pre-push hook.
Of all the docs online I couldn't find an example on how to access the committed files list.
Does anyone know how to do it?

Thanks in advance

1 answer

1 accepted

0 votes
Answer accepted

To anyone looking for the same thing, I've managed to do it by fetching all the files from a commit and iterating it

#!/bin/bash

echo "===================="

findMe="ROOT.war/"
replaceWith="webapps/ROOT/"

for file in $(git diff-tree --no-commit-id --name-only -r HEAD)
do
    # echo "file: " $file
    echo ${file//$findMe/$replaceWith}
done

echo "======================================="
exit 0

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

5,794 views 4 12
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you