git rebase
The git rebase command moves or combines a sequence of commits from one branch onto another branch. Step 1: Initialize project
git init
Step 2: create index.html file and 2 commit m1,m2 add text "m1" into index.html and commit as m1

echo "m1" > index.html
git add .
git commit -m "m1" 
add text "m2" into index.html and commit as m2

echo "m2" >> index.html
git add .
git commit -m "m2" 
Step 3: create feature branch and checkout
git checkout -b feature
Step 4: create feature folder&file add text "f1" into feature.html and commit as f1

echo "f1" >> feature.html
git add .
git commit -m "f1" 
Step 5: Checkout to master
git checkout master
Step 6: add text "m3" into index.html and commit as m3

echo "m3" >> index.html
git add .
git commit -m "m3" 
Step 7: Checkout to feature
git checkout feature
Step 8: rebase master branch into feature
git rebase master
Step 8: add text "f2" into feature.html and commit as f2

echo "f2" >> feature.html
git add .
git commit -m "f2" 
Step 9: Checkout to master
git checkout master
Step 10: Merge the feature branch into master
git rebase feature
by Luka Tatarishvili
12 months ago
Git
commands
0
Pro tip: use ```triple backticks around text``` to write in code fences