This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 17th, 2011  |  syntax: Bash  |  size: 0.63 KB  |  views: 252  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/usr/bin/sh
  2. rm -rf repo
  3. mkdir repo
  4. cd repo
  5.  
  6. git init
  7. echo -e "A\nB\nC\nD\nE" > test.txt
  8. git add .
  9. git commit -am "a"
  10.  
  11. git branch c
  12. git checkout c
  13. echo -e "A\nB\nX\nD\nE" > test.txt
  14. git commit -am "c1"
  15.  
  16. git checkout master
  17. echo -e "G\nG\nG\nA\nB\nC\nD\nE" > test.txt
  18. git commit -am "b1"
  19. echo -e "A\nB\nC\nD\nE\nG\nG\nG\nA\nB\nC\nD\nE" > test.txt
  20. git commit -am "b2"
  21.  
  22. git checkout c
  23.  
  24. if [ -z $1 ]; then
  25.     # this produces incorrect result
  26.     git rebase master
  27. else
  28.     # but if we go through revisions manually instead, we get the correct result
  29.     git rebase master~1
  30.     git rebase master
  31. fi
  32.  
  33. cat test.txt
clone this paste RAW Paste Data