Last active
May 3, 2018 21:24
-
-
Save kryten87/041b66df532f76fb05936e920db07f78 to your computer and use it in GitHub Desktop.
A simple bash function which shows files changes since a specific commit or branch
This file contains 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
# paste this into your shell alias file | |
# | |
# Usage: | |
# gitchgs # show all files changed from develop branch | |
# | |
# gitchgs a1b2c3d4 # show all files changed since commit a1b2c3d4 | |
# | |
# gitchgs some-branch # show all files changed between branch some-branch and HEAD | |
# | |
gitchgs () { | |
# get the branch from which you want the diff | |
# | |
local branch=$1 | |
# is the branch null/empty? if so, subsitute the default "develop" branch | |
# | |
if [ -z "$branch" ]; then | |
branch="develop" | |
fi | |
# show a git diff with filenames only, and showing only modified files (ie. | |
# omit deleted files) between $branch and HEAD | |
# | |
git diff --diff-filter=ACMR --name-only $branch..HEAD | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I use this shortcut constantly. For example, when I'm about to merge a branch with develop (I use git flow), I will run:
which will open all of the files which have changed in the feature branch in atom (my editor of choice). I then review each of the files before finishing the branch.