Lines Matching +full:- +full:- +full:head +full:- +full:branch
38 echo "Squash merge a given branch into the current branch"
40 echo "This command squash merges all commits from a given branch into the current branch"
42 echo "(use --no-commit and --no-list options to change default behavior)."
44 echo "Usage: $(basename "$0") [--no-list] [--no-commit] <branch> [<commit msg>]"
46 echo " <branch> Specifies the name of branch to merge into current branch"
49 echo " --no-list The commit message will not include the list of squashed commits"
50 echo " --no-commit Squash and stage the changes but do not commit "
59 --help | -h | -[?])
64 --no-list)
67 --no-commit)
70 --debug) set -x ;;
71 --*) die "Unknown argument $1" ;;
72 -*) die "Unknown argument $1" ;;
80 if [ "$#" -eq 0 ]; then
82 die "No branch name"
85 if [ "$#" -gt 2 ]; then
92 branch="$1"
93 cur_branch=$(git rev-parse --abbrev-ref HEAD)
95 # Get the list of commits (diff between current and new branch)
99 commit_list=$(git log HEAD.."$branch" --oneline --decorate=no --reverse)
104 commit_msg_header="Squash merge '$branch' into '$cur_branch'"
106 if [ -z "$2" ]; then
112 git merge --squash "$branch" 1>/dev/null 2>/dev/null || die "Failed to perform 'git merge -squash $…
115 if ! git diff --cached --quiet; then
116 echo "No changes to commit when squash merging branch '$branch' into '$cur_branch'"
122 …git commit -m "$commit_msg" 1>/dev/null 2>/dev/null || die "git commit failed${NEWLINE}${NEWLINE}$…
124 git log -1
126 echo "${NEWLINE}Successfully squash merged branch '$branch' into '$cur_branch'"
128 … echo "Successfully prepared squash merge of branch '$branch' into '$cur_branch' - ready to commit"