Settings

Theme

Challenger and learning Git rebase and resolve conflics

1 points by stvkoch 11 years ago · 1 comment · 2 min read


# Here is the code:

# Challenge and learning Git rebase and resolve conflics

# you need to order into the master branch either git history and content of other two branches without adicional commits in history line.

# you can see result of this graph with 'gitx'

mkdir challenge_rebase; cd challenge_rebase

git init; touch content.txt; git add .;

echo 'A' >> content.txt; git commit -a -m 'A';

echo 'B' >> content.txt; git commit -a -m 'B';

git checkout -b foo master;

echo 'C' >> content.txt; git commit -a -m 'C';

echo 'D' >> content.txt; git commit -a -m 'D';

echo 'E' >> content.txt; git commit -a -m 'E';

echo 'F' >> content.txt; git commit -a -m 'F';

git checkout -b bar master;

echo 'G' >> content.txt; git commit -a -m 'G';

echo 'H' >> content.txt; git commit -a -m 'H';

echo 'I' >> content.txt; git commit -a -m 'I';

echo 'J' >> content.txt; git commit -a -m 'J';

git checkout master;

echo 'L' >> content.txt; git commit -a -m 'L';

echo 'M' >> content.txt; git commit -a -m 'M';

echo 'N' >> content.txt; git commit -a -m 'N';

# What is correct response to make order into the master branch either git history and content of other two branches without adicional commits in history line?

stvkochOP 11 years ago

    # result ...
    git rebase foo bar
    # ... resolve conflicts
    git add content.txt
    git rebase --continue

    # HERE is the trick... we have several ways to make this.
    git rebase --onto bar master~3 master
    # .. resolve conflicts
    git add .
    git rebase --continue

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection