]> git.nbdom.net Git - nb.git/commitdiff
git
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 6 Dec 2016 17:39:10 +0000 (17:39 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 6 Dec 2016 17:39:10 +0000 (17:39 +0000)
etc/profile.d/git.sh

index e15041f9d1001dba99e7e8fbc902dd5aa6864a60..c688336599e64e11b82e1e9d60c82141ae3ebfa4 100644 (file)
@@ -9,10 +9,11 @@ alias git_ls_tree="git ls-tree --full-tree -r HEAD"
 alias git_ls_files="git ls-files"
 
 git_pull_reset() {
-  local branch='origin/master'
+  local branch=$(git branch --list|awk '/\*/{print $2; exit}')
   [ -n "$1" ] && branch="$1"
+  [ -z "$branch" ] && return
   git fetch --all 
-  git reset --hard $branch
+  git reset --hard "$branch"
 }
 
 git_log_files() {