Open na-hill opened 6 days ago
edit: https://github.com/doubleyou/sshrc/pull/3
Patch:
diff --git a/.gitconfig b/.gitconfig
index 001d0fe..2205b1e 100644
--- a/.gitconfig
+++ b/.gitconfig
@@ -1,31 +1,2 @@
-[user]
- email = ddemeshchuk@machinezone.com
- name = Dmitry Demeshchuk
-[color]
- ui = true
-[branch]
- autosetuprebase = always
-[core]
- excludesfile = /opt/boxen/config/git/gitignore
- editor = vim
-[difftool "sourcetree"]
- cmd = opendiff \"$LOCAL\" \"$REMOTE\"
- path =
-[mergetool "sourcetree"]
- cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
- trustExitCode = true
-
-[hub]
-protocol = https
-
-[credential]
-[http]
- sslVerify = false
-[alias]
- co = checkout
- br = branch
- ci = commit
- st = status -bs -uno
- clone-branches = "! git branch -a | sed -n \"/\\/HEAD /d; /\\/master$/d; /remotes/p;\" | xargs -L1 git checkout -t"
-[push]
- default = matching
+# This will be used in place of `~/.gitconfig` on the remote machine, which clobbers entries in `$XDG_CONFIG_HOME/git/config`.
+# To re-enable the remote `~/.gitconfig`, delete this file.
diff --git a/.scripts/aliases b/.scripts/aliases
index f897e03..7cc690f 100644
--- a/.scripts/aliases
+++ b/.scripts/aliases
@@ -2,10 +2,16 @@ alias .="cd .."
alias vi=vim
git() {
+ if [[ -f "$SSHHOME/.sshrc.d/.gitconfig" ]] ; then
+ GITHOME="$SSHHOME/.sshrc.d/"
+ else
+ GITHOME="$HOME"
+ fi
+
if [[ $@ == "log" ]] && command -v tig > /dev/null 2>&1 ; then
- command git log | tig;
+ HOME="$GITHOME" command git log | tig;
else
- command git "$@";
+ HOME="$GITHOME" command git "$@";
fi
}
diff --git a/git/config b/git/config
new file mode 100644
index 0000000..001d0fe
--- /dev/null
+++ b/git/config
@@ -0,0 +1,31 @@
+[user]
+ email = ddemeshchuk@machinezone.com
+ name = Dmitry Demeshchuk
+[color]
+ ui = true
+[branch]
+ autosetuprebase = always
+[core]
+ excludesfile = /opt/boxen/config/git/gitignore
+ editor = vim
+[difftool "sourcetree"]
+ cmd = opendiff \"$LOCAL\" \"$REMOTE\"
+ path =
+[mergetool "sourcetree"]
+ cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
+ trustExitCode = true
+
+[hub]
+protocol = https
+
+[credential]
+[http]
+ sslVerify = false
+[alias]
+ co = checkout
+ br = branch
+ ci = commit
+ st = status -bs -uno
+ clone-branches = "! git branch -a | sed -n \"/\\/HEAD /d; /\\/master$/d; /remotes/p;\" | xargs -L1 git checkout -t"
+[push]
+ default = matching
Git applies
$XDG_CONFIG_HOME/git/config
, followed by$HOME/.gitconfig
.Currently it does not find
.gitconfig
at all, and even if it does, it can get clobbered by remote$HOME
, which may or may not be desirable.