installed_progs.t: Python checks stdout too, 150 ok
[sunny256-utils.git] / git-mnff
bloba6fa9be033a700c72efbbad9de0bf69639469cee
1 #!/usr/bin/env bash
3 #=======================================================================
4 # git-mnff
5 # File ID: b72aedb2-f178-11e4-a17f-000df06acc56
7 # Perform Git merges without fast-forwarding. Useful for visualising
8 # related commits.
10 # Syntax:
12 # git mnff BRANCHNAME
13 # git mnff BRANCHNAME STARTREVISION_OF_BRANCH
15 # Author: Øyvind A. Holm <sunny@sunbase.org>
16 # License: GNU General Public License version 2 or later.
17 #=======================================================================
19 git wait-until-clean -u
21 branch=$1
22 if test -n "$2"; then
23 reset="$2"
24 git branch $branch &&
25 git reset --hard $reset
28 if test $(git log --format='%h' ..$branch | wc -l) -lt 2; then
29 # There is only one commit, use fast-forward if possible
30 git merge $branch
31 else
32 # There is more than 1 commit, use --no-ff
33 git merge --no-ff $branch
36 git branch -d $branch