What if it could be as easy as this?
git changed
If you're willing to assume that the main branch is called "master", and that you create your other branches from master, then you can add this alias to your ~/.gitconfig
file to make it that easy:
cbranch = !"git branch | grep '*' | cut -f2 -d' '"
changed = !"git diff --name-only $(git cbranch) $(git merge-base $(git cbranch) master)"
Those assumptions will work for most people in most situations, but you must be aware that you're making them.
Also, you must use a shell that supports $()
. It's very likely that your shell supports this.