Is there a bash command to get the date/time a branch was merged into master or develop?
I want to make a program.sh and pass branch name with parameter.
program.sh hotfix_1254
the output would be
hotfix_1254: master ok | merged on 2016-06-04 17:18
hotfix_1254: develop FAIL | merged on -
How can I do that?
You could use a combo of the following, cooked into a script:
From How can I know in git if a branch has been already merged into master? You can use the git merge-base command to find the best common commit between the two branches. If that commit is the same as your branch head, then the branch has been completely merged.
Take that output (honoring above criteria) and do a git log -n 1 --pretty=format:%cd branchName
to print the commit date
For example:
git branch --merged | grep otherBranch
If above is true (ie, otherBranch was merged), then
git merge-base refs/heads/master otherBranch | xargs git log -n 1 --pretty=format:%cd
if you do git log --grep=<pattern>
then you should get the log(s) for that branch. if you want just the date you will have to parse it further using bash.
tks for all. Your explanations give me suport to build this git-branch-check.sh
to validate my branchs.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.