Pair Programming is great - here's a way to make it greater with easy way to toggle on mutliple attribution for each a commit.
Add this alias to your global .gitconfig
file (git config --global --edit
)
[alias]
pair = "!f() { \
local name=$1; \
shopt -s nocasematch; \
case $name in \
'John') \
git config user.name 'John and Kyle'; \
git config user.email John.Doe@domain.com; \
;; \
'James') \
git config user.name 'James and Kyle'; \
git config user.email James.Bond@domain.com; \
;; \
'Reset') \
git config user.name 'Kyle XY'; \
git config user.email Kyle.XY@domain.com; \
;; \
*) \
;; \
esac; \
echo 'Co-authored-by: Kyle XY <kyle.XY@domain.com>' | clip.exe; \
}; f"
Then you can use it like this:
git pair John
~/.gitconfig
[alias]
co = checkout
OR
$ git config --global alias.co checkout
Execute Bash Command inside of Git Alias
my_alias = "!f() { 〈your complex command〉 }; f"
$1
will access the first parameter- If you would like to wrap over multiple lines, each will need to be terminated with a
\
as a line continuation character
name=Kyle
echo $name
case "$C" in
"1")
do_this()
;;
"2" | "3")
do_what_you_are_supposed_to_do()
;;
*)
do_nothing()
;;
esac
Bash - Case Insensitive String Compare
str1="MATCH"
str2="match"
shopt -s nocasematch
case "$str1" in
$str2 ) echo "match";;
*) echo "no match";;
esac
Bash Copy variable to clipboard | Copy to Clipboard on windows
echo "bar" | xclip # Linux
echo "foo" | pbcopy # MacOS
echo "baz" | clip.exe # Windows