Last active
August 29, 2015 14:26
Revisions
-
jfairbank revised this gist
Jul 29, 2015 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ #!/bin/bash # git diff a file and then be presented with the option to stage # the file with "y" or stage a portion with patch via "p" filepath="${1-.}" -
jfairbank created this gist
Jul 29, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ #!/bin/bash # git diff a file and then be presented with the option to stage the file with "y" or stage a portion with patch via "p" filepath="${1-.}" git diff "$filepath" [[ $? -ne 0 ]] && exit printf "\nOk to stage? [y/p/N]: " read stage if [[ "$stage" == "y" || "$stage" == "Y" ]]; then git add "$filepath" elif [[ "$stage" == "p" || "$stage" == "P" ]]; then git add -p "$filepath" fi