Skip to content

Instantly share code, notes, and snippets.

@RichardBray
Created May 20, 2024 08:47
Show Gist options
  • Save RichardBray/f4d4e3c82784f14dc68da19400ecd5ad to your computer and use it in GitHub Desktop.
Save RichardBray/f4d4e3c82784f14dc68da19400ecd5ad to your computer and use it in GitHub Desktop.

Revisions

  1. RichardBray created this gist May 20, 2024.
    23 changes: 23 additions & 0 deletions git-pull.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    #!/bin/bash
    # This script is a W.I.P
    # To use it, just save the file and run sh git-pull.sh

    git fetch

    git diff HEAD..FETCH_HEAD

    read -p "Do you want to merge? (Y/n) " answer

    if [[ -z "$answer" ]]; then
    answer="y"
    fi

    case ${answer:0:1} in
    y|Y )
    git merge FETCH_HEAD
    echo "Thank you for merging."
    ;;
    * )
    echo "Exiting without merging."
    ;;
    esac