Permalink
Browse files

More git stuff.

  • Loading branch information...
1 parent e5b4455 commit 3560e30e5370e86fd738c4d56889045c56736ef2 @cowboy committed Mar 10, 2012
Showing with 16 additions and 1 deletion.
  1. +3 −0 copy/.gitconfig
  2. +13 −1 source/50_vcs.sh
View
3 copy/.gitconfig
@@ -22,6 +22,9 @@
rv = review
st = status
ksdiff = difftool -y -t Kaleidoscope
+[branch "master"]
+ remote = origin
+ merge = refs/heads/master
@mathiasbynens
mathiasbynens Mar 13, 2012

What does this do? I was under the impression this was the default (but I’m probably wrong, then).

@cowboy
cowboy Mar 13, 2012

From http://stackoverflow.com/questions/658885/how-do-you-get-git-to-always-pull-from-a-specific-branch

This tells Git 2 things:

  1. When you're on the master branch, the default remote is origin.
  2. When using git pull on the master branch, with no remote and branch specified, use the default remote (origin) and merge in the changes from the master branch.
[color]
ui = auto
[color "branch"]
View
14 source/50_vcs.sh
@@ -18,10 +18,22 @@ alias gba='git branch -a'
function gc() { git checkout "${@:-master}"; } # Checkout master by default
alias gco='gc'
alias gcb='gc -b'
-alias gra='git remote add'
+alias gr='git remote'
+alias grv='gr -v'
+#alias gra='git remote add'
alias grr='git remote rm'
alias gcl='git clone'
+# add a github remote by github username
+function gra() {
+ if (( "${#@}" != 1 )); then
+ echo "Usage: gra githubuser"
+ return 1;
+ fi
+ local repo=$(gr show -n origin | perl -ne '/Fetch URL: .*github\.com[:\/].*\/(.*)/ && print $1')
+ gr add "$1" "git://github.com/$1/$repo"
+}
+
# OSX-specific Git shortcuts
if [[ "$OSTYPE" =~ ^darwin ]]; then
alias gdk='git ksdiff'

0 comments on commit 3560e30

Please sign in to comment.