C:\Users\wpollock\Desktop\Java>md rebasedemo.git C:\Users\wpollock\Desktop\Java>cd rebasedemo.git C:\Users\wpollock\Desktop\Java\rebasedemo.git>git init Initialized empty Git repository in C:/Users/wpollock/Desktop/Java/rebasedemo.git/.git/ C:\Users\wpollock\Desktop\Java\rebasedemo.git>notepad++ ReadMe.txt C:\Users\wpollock\Desktop\Java\rebasedemo.git>type ReadMe.txt This is a sample file with several lines in it, used to illustrate various Git commands. C:\Users\wpollock\Desktop\Java\rebasedemo.git>git add . C:\Users\wpollock\Desktop\Java\rebasedemo.git>git commit -m "Initial Commit" [master (root-commit) cabfd05] Initial Commit 1 file changed, 3 insertions(+) create mode 100644 ReadMe.txt C:\Users\wpollock\Desktop\Java\rebasedemo.git>git checkout -b feature Switched to a new branch 'feature' C:\Users\wpollock\Desktop\Java\rebasedemo.git>notepad++ ReadMe.txt C:\Users\wpollock\Desktop\Java\rebasedemo.git>git commit -a -m "changed line 1" [feature 0b5519a] changed line 1 1 file changed, 1 insertion(+), 1 deletion(-) C:\Users\wpollock\Desktop\Java\rebasedemo.git>git commit -a -m "changed line 2" [feature 7be1233] changed line 2 1 file changed, 1 insertion(+), 1 deletion(-) C:\Users\wpollock\Desktop\Java\rebasedemo.git>git commit -a -m "changed line 2" [feature f1838d7] changed line 2 1 file changed, 1 insertion(+), 1 deletion(-) C:\Users\wpollock\Desktop\Java\rebasedemo.git>git checkout master Switched to branch 'master' C:\Users\wpollock\Desktop\Java\rebasedemo.git>notepad++ ReadMe.txt C:\Users\wpollock\Desktop\Java\rebasedemo.git>git commit -a -m "Added two lines at end" [master 2e4d0bb] Added two lines at end 1 file changed, 2 insertions(+) C:\Users\wpollock\Desktop\Java\rebasedemo.git>git mylog * Commit: 2e4d0bb, Parent(s): cabfd05, Author: Wayne, Date: Tue Feb 9 03:12:22 2021 -0500 (HEAD -> master) | Added two lines at end | | | * Commit: f1838d7, Parent(s): 7be1233, Author: Wayne, Date: Tue Feb 9 03:10:35 2021 -0500 (feature) | | changed line 2 | | | | | * Commit: 7be1233, Parent(s): 0b5519a, Author: Wayne, Date: Tue Feb 9 03:10:18 2021 -0500 | | changed line 2 | | | | | * Commit: 0b5519a, Parent(s): cabfd05, Author: Wayne, Date: Tue Feb 9 03:09:40 2021 -0500 |/ changed line 1 | | * Commit: cabfd05, Parent(s): , Author: Wayne, Date: Tue Feb 9 03:08:17 2021 -0500 Initial Commit (Notice how branch "feature" has three commits.) C:\Users\wpollock\Desktop\Java\rebasedemo.git>type ReadMe.txt This is a sample file with several lines in it, used to illustrate various Git commands. Added some lines in master branch. C:\Users\wpollock\Desktop\Java\rebasedemo.git>git checkout feature Switched to branch 'feature' First we will squash the three commits on feature branch into one: C:\Users\wpollock\Desktop\Java\rebasedemo.git>type ReadMe.txt This is a sample file Made change 1 in feature branch with several lines in it, Made change 2 in feature branch used to illustrate various Git commands. Made change 3 in feature branch C:\Users\wpollock\Desktop\Java\rebasedemo.git>git rebase -i HEAD~3 ======================================================================== Editor opens with rebasing script. Make changes to two lines (replace "pick" with "squash": pick 0b5519a changed line 1 squash 7be1233 changed line 2 squash f1838d7 changed line 3 # Rebase cabfd05..f1838d7 onto cabfd05 (3 commands) # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # b, break = stop here (continue rebase later with 'git rebase --continue') # d, drop = remove commit # l, label