Created
February 12, 2014 20:25
-
-
Save revans/8963840 to your computer and use it in GitHub Desktop.
Search the git log from a specific point in time for merge commits from one specific branch into another.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# by: Robert Evans | |
# | |
# Git Merge Since Search | |
# | |
# I needed to be able to search git history looking for all merge commits from | |
# a specific repo, into another specific repo, starting at a given point in time. | |
# | |
# Example: | |
# | |
# This little script accomplishes this. Here is how you'd run it: | |
# | |
# since date from to | |
# branch branch | |
# | |
# git-merge-since "12/20/2013" staging master | |
# | |
# The above command would search the git logs, starting at 12/20/2013 | |
# and look for merge commits where staging was merged into the master branch. | |
# | |
# The output retains the git log colors and is formatted to look like this: | |
# | |
# ac3e00e Merge branch 'staging' into development Robert Evans, 2 weeks ago | |
# afa6a8c Merge branch 'staging' into development Robert Evans, 3 weeks ago | |
# e45511f Merge branch 'staging' into development Robert Evans, 3 weeks ago | |
# a17bd07 Merge branch 'staging' into development Robert Evans, 3 weeks ago | |
# 2350546 Merge branch 'staging' into development Robert Evans, 3 weeks ago | |
# 6fa3c6b Merge branch 'staging' into development Robert Evans, 4 weeks ago | |
# | |
set -e | |
date=$1 | |
from_repo=$2 | |
to_repo=$3 | |
search="'$2' into $3" | |
git log --since="$1" --merges --pretty=format':%C(red)%h%Creset %s %C(green) %an, %ar%Creset' --grep="$search" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment