Skip to content

Instantly share code, notes, and snippets.

@znz
Created August 13, 2017 06:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save znz/ebe07dc354f21b75e6a81fe22962586a to your computer and use it in GitHub Desktop.
Save znz/ebe07dc354f21b75e6a81fe22962586a to your computer and use it in GitHub Desktop.
git merge と git rebase の挙動の違いの確認
#!/bin/sh
set -eux
mkdir /tmp/x
cd /tmp/x
git init
echo hello > hello.txt
git add .
git commit -m "Initial commit"
git remote add origin /tmp/repo
mkdir /tmp/repo
cd /tmp/repo
git init --bare
cd /tmp/x
git push -u origin master
git clone /tmp/repo /tmp/y
cd /tmp/y
git checkout -b hello
echo hello >> hello.txt
git commit -am "More hello"
git push origin hello
cd /tmp/x
git pull
git merge --no-ff origin/hello
git push
cd /tmp/y
git fetch origin
git checkout master
echo bye > bye.txt
git add bye.txt
git commit -m Bye
# git merge origin/master
# git rebase origin/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment