Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
git branch myRestoredBranch 724d9acd

Exercises

Rebase Merge conflicts

Create a repo:

Code Block

mkdir pristine && cd pristine
git init

Create a new file "test.txt" with the following content:
"the brown dog jumped over the lazy fox"

Code Block

git add test.txt
git commit -m "initial commit"

Do some work on a feature branch

Code Block

git checkout -b feature

edit the test.txt and make the content:
"the purple dog jumped over the lazy fox"

Code Block

git add test.txt
git commit -m "brown is out of style"

Simulate someone else doing work but making a conflicting commit on master

Code Block

git checkout master

edit the test.txt to make the content:
"the brown dog jumped over the lazy turtle"

Code Block

git add test.txt
git commit -m "brown is out of style"

Now back to your feature, rebase on top of master and you'll have a Merge!

Code Block

git checkout feature
git rebase master

Handle the merge

Code Block

git mergetool test.txt
git rebase --continue

Developing with Git source controlled projects