-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathgd.sh
49 lines (38 loc) · 782 Bytes
/
gd.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
#
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 11.28.2017
#
# git diff
# shellcheck source=/dev/null
. ~/.fancy-git/modules/settings-manager.sh
git_use_clear=$(fancygit_config_get "git_use_clear" "true")
clear_if_enabled () {
if [ "$git_use_clear" = "true" ]; then
clear
fi
}
# It's more like a return command. This is a Mac OS issue.
fg_return() {
exit
}
clear_if_enabled
if [ "$1" = "" ]; then
git diff
fg_return
fi
git diff "$1"
echo ""
read -rp " Add this file to commit? [y/N]: " r
if [ "$r" = "y" ]; then
git add "$1"
clear_if_enabled
git status
fg_return
fi
read -rp " Rollback this file changes? [y/N]: " r
if [ "$r" = "y" ]; then
git checkout "$1"
fi
clear_if_enabled
git status