1. Martin Tournoij
  2. config

Commits

Martin Tournoij  committed 82c517f

Git scripts

  • Participants
  • Parent commits 51b7cc0
  • Branches default

Comments (0)

Files changed (5)

File home/bin/git-addremove

View file
+#!/bin/sh -e
+#
+# add/remove all changes from the index, similar to hg addremove
+# From: https://github.com/ddollar/git-utils
+#
+
+git add -A $@
+git ls-files --deleted -z $@ | xargs -0 git rm 

File home/bin/git-incoming

View file
+#!/bin/sh -e
+#
+# Shows incoming commits from the tracked (or specified) branch
+# Adapted from: https://github.com/ddollar/git-utils
+#
+
+curbranch=$(git rev-parse --abbrev-ref HEAD)
+if [ "$curbranch" = "" ]; then
+    echo Unable to get current branch name
+    exit 1
+fi
+
+target="$1"
+
+if [ "$target" = "" ]; then
+    tracking="$(git config "branch.$curbranch.remote")"
+
+    if [ "$tracking" != "" ]; then
+        remote_branch="$(git config "branch.${curbranch}.merge" | sed -e 's#^[^/]*/[^/]*/##')"
+        target="$tracking/$remote_branch"
+    fi
+fi
+
+git log "..$target"

File home/bin/git-outgoing

View file
+#!/bin/sh -e
+#
+# Show outgoing commits to the tracked (or specified) branch
+# From: https://github.com/ddollar/git-utils
+#
+
+curbranch=$(git rev-parse --abbrev-ref HEAD)
+if [ "$curbranch" = "" ]; then
+    echo Unable to get current branch name
+    exit 1
+fi
+
+target="$1"
+
+if [ "$target" = "" ]; then
+    tracking="$(git config "branch.$curbranch.remote")"
+
+    if [ "$tracking" != "" ]; then
+        remote_branch="$(git config "branch.${curbranch}.merge" | sed -e 's#^[^/]*/[^/]*/##')"
+        target="$tracking/$remote_branch"
+    fi
+fi
+
+git log "$target.."

File home/bin/git-save

View file
+#!/bin/sh -e
+#
+# Adapted from:
+# https://codingkilledthecat.wordpress.com/2012/04/27/git-stash-pop-considered-harmful/
+# 
+
+prev=$(git symbolic-ref HEAD | cut -d/ -f3-)
+
+git checkout -b "$1"
+git commit -am "$1"
+git checkout "$prev"' -

File home/dot.gitconfig

View file
 [alias]
 	st = status --short
 	ci = commit -a
+	co = checkout
 
 [color]
 	status =