From cef30030bef011b506a568b5a1bd46b99ead72c0 Mon Sep 17 00:00:00 2001 From: Guangxiong Lin Date: Sun, 23 Jan 2022 12:29:00 +0800 Subject: Add function and alias to help code review Add following aliases: - gmf: Show the changed files from base branch to current branch - gmfn: Similar to gmfn, but only contains the name of changed files Add a function: - greview: Open all changed files in vim. Map gd to show the diff between base branch and current branch. --- .functions | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to '.functions') diff --git a/.functions b/.functions index 9390af8..879804c 100644 --- a/.functions +++ b/.functions @@ -9,3 +9,21 @@ open () { echo "No usable program is found" fi } + +greview () { + usage='usage: greview ' + if [ $# -lt 1 ]; then + echo $usage + return + fi + + base_branch=$1 + # vim -p $(git diff --merge-base --name-only $base_branch) \ + # "+tabdo Gvdiff $base_branch" \ + # "+nmap :tabnext" \ + # "+nmap :tabpreivous" + + vim $(git diff --merge-base --name-only $base_branch) \ + "+nmap gd :Gvdiffsplit $base_branch" + +} -- cgit v1.2.3