File: gitup

package info (click to toggle)
digikam 4%3A7.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 511,244 kB
  • sloc: cpp: 754,438; ansic: 41,776; xml: 18,008; sh: 5,484; sql: 3,076; perl: 2,386; python: 2,310; javascript: 1,828; yacc: 958; objc: 340; lex: 315; ruby: 165; java: 54; makefile: 46
file content (20 lines) | stat: -rwxr-xr-x 555 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

# A git pull --rebase which will stash away local changes first, if any
# Author: David Faure <faure@kde.org>
# Adapted to return the correct return value (for the gits script): Marcel Wiesweg <marcel.wiesweg@gmx.de>
# Usage: add this alias in your .gitconfig:
# up = !gitup
# or, if the script is not in your path,
# up = !/path/to/the/script/gitup

ns=`git diff | wc -l`
test $ns -eq 0 && ns=`git diff --cached | wc -l`

test $ns -gt 0 && git stash
git pull --rebase
retval=$?
test $ns -gt 0 && git stash pop --index --quiet

exit $retval