Skip to content

Instantly share code, notes, and snippets.

@IchHabRecht
Last active December 22, 2015 19:49
Show Gist options
  • Select an option

  • Save IchHabRecht/6522551 to your computer and use it in GitHub Desktop.

Select an option

Save IchHabRecht/6522551 to your computer and use it in GitHub Desktop.

Revisions

  1. IchHabRecht revised this gist Feb 6, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-write-changelog
    Original file line number Diff line number Diff line change
    @@ -28,7 +28,7 @@ if `git branch --no-color | grep -q '^\*'`; then
    HEAD=""
    BRANCH=`git branch --no-color | grep '^\*' | grep -v 'no branch' | sed 's/^* //g' | sed 's/.*\///g' | grep '^[0-9][0-9.]'`
    if [ "$BRANCH" != "" ]; then
    DATE=`date -I`
    DATE=`date +%Y-%m-%d`
    DIR=${PWD##*/}
    USER=`git config --get user.name`
    HEAD="$DATE [RELEASE] Release of $DIR $BRANCH ($USER)"$'\n'
  2. IchHabRecht revised this gist Sep 13, 2013. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion git-write-changelog
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,9 @@ GITPATH="master..HEAD"

    while [ "$1" != "" ]; do
    case $1 in
    -c )
    GITPATH=""
    ;;
    -w )
    WRITE=true
    ;;
    @@ -51,8 +54,9 @@ if `git branch --no-color | grep -q '^\*'`; then
    fi

    # USAGE
    # git write-changelog [-w] [-f <filename>] [<path>]
    # git write-changelog [-c] [-w] [-f <filename>] [<path>]
    # git write-changelog [-w] [-f ChangeLog] [master..HEAD]
    # -c: Write log for whole changes
    # -w: Write log to file
    # -f <filename>: Name of changelog file
    # path: path for git log
  3. IchHabRecht revised this gist Sep 11, 2013. 1 changed file with 58 additions and 60 deletions.
    118 changes: 58 additions & 60 deletions git-write-changelog
    Original file line number Diff line number Diff line change
    @@ -1,60 +1,58 @@


    #!/bin/sh

    WRITE=false
    FILE="ChangeLog"
    GITPATH="master..HEAD"

    while [ "$1" != "" ]; do
    case $1 in
    -w )
    WRITE=true
    ;;
    -f )
    shift
    FILE="$1"
    ;;
    * )
    GITPATH="$1"
    ;;
    esac
    shift
    done

    if `git branch --no-color | grep -q '^\*'`; then
    OUTPUT=""
    HEAD=""
    BRANCH=`git branch --no-color | grep '^\*' | grep -v 'no branch' | sed 's/^* //g' | sed 's/.*\///g' | grep '^[0-9][0-9.]'`
    if [ "$BRANCH" != "" ]; then
    DATE=`date -I`
    DIR=${PWD##*/}
    USER=`git config --get user.name`
    HEAD="$DATE [RELEASE] Release of $DIR $BRANCH ($USER)"$'\n'
    fi

    LOG=`git log --pretty=format:"%ad %h %s (%an)" --date=short --no-merges $GITPATH`
    if [ "$LOG" != "" ]; then
    OUTPUT=$HEAD$LOG$'\n'$'\n';
    fi

    if [ -f $FILE ]; then
    OUTPUT=$OUTPUT"`cat $FILE`"
    fi

    if $WRITE; then
    echo "$OUTPUT" > $FILE

    OUTPUT=$OUTPUT$'\n'$'\n'"File $FILE was written."
    fi

    echo "$OUTPUT"

    fi

    # USAGE
    # git write-changelog [-w] [-f <filename>] [<path>]
    # git write-changelog [-w] [-f ChangeLog] [master..HEAD]
    # -w: Write log to file
    # -f <filename>: Name of changelog file
    # path: path for git log
    #!/bin/sh

    WRITE=false
    FILE="ChangeLog"
    GITPATH="master..HEAD"

    while [ "$1" != "" ]; do
    case $1 in
    -w )
    WRITE=true
    ;;
    -f )
    shift
    FILE="$1"
    ;;
    * )
    GITPATH="$1"
    ;;
    esac
    shift
    done

    if `git branch --no-color | grep -q '^\*'`; then
    OUTPUT=""
    HEAD=""
    BRANCH=`git branch --no-color | grep '^\*' | grep -v 'no branch' | sed 's/^* //g' | sed 's/.*\///g' | grep '^[0-9][0-9.]'`
    if [ "$BRANCH" != "" ]; then
    DATE=`date -I`
    DIR=${PWD##*/}
    USER=`git config --get user.name`
    HEAD="$DATE [RELEASE] Release of $DIR $BRANCH ($USER)"$'\n'
    fi

    LOG=`git log --pretty=format:"%ad %h %s (%an)" --date=short --no-merges $GITPATH`
    if [ "$LOG" != "" ]; then
    OUTPUT=$HEAD$LOG$'\n'$'\n';
    fi

    if [ -f $FILE ]; then
    OUTPUT=$OUTPUT"`cat $FILE`"
    fi

    if $WRITE; then
    echo "$OUTPUT" > $FILE

    OUTPUT=$OUTPUT$'\n'$'\n'"File $FILE was written."
    fi

    echo "$OUTPUT"

    fi

    # USAGE
    # git write-changelog [-w] [-f <filename>] [<path>]
    # git write-changelog [-w] [-f ChangeLog] [master..HEAD]
    # -w: Write log to file
    # -f <filename>: Name of changelog file
    # path: path for git log
  4. IchHabRecht created this gist Sep 11, 2013.
    60 changes: 60 additions & 0 deletions git-write-changelog
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,60 @@


    #!/bin/sh

    WRITE=false
    FILE="ChangeLog"
    GITPATH="master..HEAD"

    while [ "$1" != "" ]; do
    case $1 in
    -w )
    WRITE=true
    ;;
    -f )
    shift
    FILE="$1"
    ;;
    * )
    GITPATH="$1"
    ;;
    esac
    shift
    done

    if `git branch --no-color | grep -q '^\*'`; then
    OUTPUT=""
    HEAD=""
    BRANCH=`git branch --no-color | grep '^\*' | grep -v 'no branch' | sed 's/^* //g' | sed 's/.*\///g' | grep '^[0-9][0-9.]'`
    if [ "$BRANCH" != "" ]; then
    DATE=`date -I`
    DIR=${PWD##*/}
    USER=`git config --get user.name`
    HEAD="$DATE [RELEASE] Release of $DIR $BRANCH ($USER)"$'\n'
    fi

    LOG=`git log --pretty=format:"%ad %h %s (%an)" --date=short --no-merges $GITPATH`
    if [ "$LOG" != "" ]; then
    OUTPUT=$HEAD$LOG$'\n'$'\n';
    fi

    if [ -f $FILE ]; then
    OUTPUT=$OUTPUT"`cat $FILE`"
    fi

    if $WRITE; then
    echo "$OUTPUT" > $FILE

    OUTPUT=$OUTPUT$'\n'$'\n'"File $FILE was written."
    fi

    echo "$OUTPUT"

    fi

    # USAGE
    # git write-changelog [-w] [-f <filename>] [<path>]
    # git write-changelog [-w] [-f ChangeLog] [master..HEAD]
    # -w: Write log to file
    # -f <filename>: Name of changelog file
    # path: path for git log