ragnarokkrr
11/15/2016 - 6:48 PM

rebase test http://stackoverflow.com/questions/2427238/in-git-what-is-the-difference-between-merge-squash-and-rebase http://blog.houen.net

$ git checkout feature
#  edit...
$ git checkout -b temp-branch
$ git rebase -i HEAD~7
$ git checkout master
#  edit...
$ git checkout temp-branch
$ git rebase master
$ git checkout master
$ git rebase temp-branch
$ git checkout -b feature
# edit...
$ git checkout master
$ git merge --squash feature
$ git commit -m “feature”
$ git checkout feature
$ git checkout -b temporary-branch
$ git rebase -i master
# [Clean up the history]
$ git checkout master
$ git merge temporary-branch
# find merge base between two branches
$ git merge-base feature-branch master

#iterative rebase branch

$ git rebase -i HEAD~12


# merge scauwsh

$ git merge --squash feature1
#!/bin/bash

#usage

if [ $# -ne 3 ]; then
  echo $0: usage 02_edit.sh [prj] [clone] [filename] # ./03_git_clone.sh prj myprj_02_merge_squash source.txt
fi
src=`pwd`
prj=$1
prj_clone=$2
filename=$3

path_clone="$src/$prj_clone"
file="$path_clone/$filename"

function clone(){
  git clone $prj $prj_clone
  echo "CLONE OK"
}

function gen_revisions() {
  cd $path_clone
  touch $file
  for i in {100..106}
  do
    echo "creating $i source line"
    echo "$i source line ($prj_clone)" >> $file
    git add $file
    echo "$prj_clone commiting $i source line"
    git commit -m "$prj_clone commit revision $i"
  done
  echo "GEN REVISIONS OK"
}


function feature_branch() {
    cd $path_clone
    git checkout -b feature-branch
    echo "FEATURE BRANCH OK"
}

function back() {
  cd $src
}

clone
feature_branch
gen_revisions
back

echo "ok"
#!/bin/bash

if [ $# -ne 3 ]; then
  echo $0: usage 02_central_repo.sh [prj] [file] # ./02_central_repo.sh prj source.txt
fi
src=`pwd`
prj=$1
filename=$2
prj_dir="$src/$prj"
file="$prj_dir/$filename"

echo $prj $filename $file $src

function gen_revisions() {
  cd $prj_dir
  touch $file
  for i in {1..5}
  do
    echo "creating $i source line"
    echo "$i source line" >> $file
    git add $file
    echo "commiting $i source line"
    git commit -m "commit revision $i"
  done
}


function git_init() {
  mkdir $prj_dir
  git init $prj_dir
}


function back() {
  cd $src
}

git_init
gen_revisions
back

echo "ok"
-

Merge squash merges a tree (a sequence of commits) into a single commit. That is, it squashes all changes made in n commits into a single commit.

Rebasing is re-basing, that is, choosing a new base (parent commit) for a tree. Maybe the mercurial term for this is more clear: they call it transplant because it's just that: picking a new ground (parent commit, root) for a tree.

When doing an interactive rebase, you're given the option to either squash, pick, edit or skip the commits you are going to rebase.

Hope that was clear!