git merge --squash
The git merge --squash command combines changes from one branch into another branch but does not create a merge commit. 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 create feature.html into the feature folder and add text "f1" then commit as f1

echo "f1" >> feature/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: add text "f2" into feature.html and commit as f2

echo "f1" >> feature/feature.html
git add .
git commit -m "f2" 
Step 9: Checkout to master
git checkout master
Step 10: Merge feature branch into master with squash
git merge --squash feature
Step 11: See git status because files we will have into the staging area and we need create a commit for it

git status
git commit -m "Merge feature branch into master"
by Luka Tatarishvili
12 months ago
Git
commands
1
Pro tip: use ```triple backticks around text``` to write in code fences