when did merge branch into master and develop?

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.

git-branch-check

链接地址: http://www.djcxy.com/p/26068.html

上一篇: 使用git rest api检查最后一次提交是否为主文件

下一篇: 什么时候合并分支进入高手并发展?