Reputation: 81
I am looking to get all the filenames for a particular release and check if we have the latest committed files in the release branch.
The below command gives all the filenames in the release branch
git ls-files
I can then loop in the filenames as per the below command, to get the commitID|Author|commit Date|Commit Message.
git log -1 --source --date=format:"%Y-%m-%d" --all --pretty="~|%h|%an|%ad|%s|" $filename
How can I get the filename and parent branch(the branch from which the code is merged to release) as an output to above command.
Also, I want to verify if the file is present in any other feature/bug fix branch and not yet merged. One way is that I can loop the above command with all the branches created for particular month(we have month YYYYMM as naming convention of branch) and then compare if the latest modification is not present in the release branch. Any better way to do this?
Upvotes: 1
Views: 57
Reputation: 81
I got the solution. If we remove --all then it will show only the file committed in the particular branch. I can loop for all the branches and determine the latest commit.
git log -1 --source --date=format:"%Y-%m-%d" --pretty="~|%h|%an|%ad|%s|" $filename
Upvotes: 1