RebaseDemo.txt

Download RebaseDemo.txt

  1: C:\Users\wpollock\Desktop\Java>md rebasedemo.git
  2: 
  3: C:\Users\wpollock\Desktop\Java>cd rebasedemo.git
  4: 
  5: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git init
  6: Initialized empty Git repository in C:/Users/wpollock/Desktop/Java/rebasedemo.git/.git/
  7: 
  8: C:\Users\wpollock\Desktop\Java\rebasedemo.git>notepad++ ReadMe.txt
  9: 
 10: C:\Users\wpollock\Desktop\Java\rebasedemo.git>type ReadMe.txt
 11: This is a sample file
 12: with several lines in it,
 13: used to illustrate various Git commands.
 14: 
 15: 
 16: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git add .
 17: 
 18: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git commit -m "Initial Commit"
 19: [master (root-commit) cabfd05] Initial Commit
 20:  1 file changed, 3 insertions(+)
 21:  create mode 100644 ReadMe.txt
 22: 
 23: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git checkout -b feature
 24: Switched to a new branch 'feature'
 25: 
 26: C:\Users\wpollock\Desktop\Java\rebasedemo.git>notepad++ ReadMe.txt
 27: 
 28: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git commit -a -m "changed line 1"
 29: [feature 0b5519a] changed line 1
 30:  1 file changed, 1 insertion(+), 1 deletion(-)
 31: 
 32: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git commit -a -m "changed line 2"
 33: [feature 7be1233] changed line 2
 34:  1 file changed, 1 insertion(+), 1 deletion(-)
 35: 
 36: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git commit -a -m "changed line 2"
 37: [feature f1838d7] changed line 2
 38:  1 file changed, 1 insertion(+), 1 deletion(-)
 39: 
 40: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git checkout master
 41: Switched to branch 'master'
 42: 
 43: C:\Users\wpollock\Desktop\Java\rebasedemo.git>notepad++ ReadMe.txt
 44: 
 45: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git commit -a -m "Added two lines at end"
 46: [master 2e4d0bb] Added two lines at end
 47:  1 file changed, 2 insertions(+)
 48: 
 49: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git mylog
 50: * Commit: 2e4d0bb, Parent(s): cabfd05, Author: Wayne, Date: Tue Feb 9 03:12:22 2021 -0500  (HEAD -> master)
 51: | Added two lines at end
 52: |
 53: |
 54: | * Commit: f1838d7, Parent(s): 7be1233, Author: Wayne, Date: Tue Feb 9 03:10:35 2021 -0500  (feature)
 55: | | changed line 2
 56: | |
 57: | |
 58: | * Commit: 7be1233, Parent(s): 0b5519a, Author: Wayne, Date: Tue Feb 9 03:10:18 2021 -0500
 59: | | changed line 2
 60: | |
 61: | |
 62: | * Commit: 0b5519a, Parent(s): cabfd05, Author: Wayne, Date: Tue Feb 9 03:09:40 2021 -0500
 63: |/  changed line 1
 64: |
 65: |
 66: * Commit: cabfd05, Parent(s): , Author: Wayne, Date: Tue Feb 9 03:08:17 2021 -0500
 67:   Initial Commit
 68: 
 69: 
 70: (Notice how branch "feature" has three commits.)
 71: 
 72: C:\Users\wpollock\Desktop\Java\rebasedemo.git>type ReadMe.txt
 73: This is a sample file
 74: with several lines in it,
 75: used to illustrate various Git commands.
 76: 
 77: Added some lines in master branch.
 78: 
 79: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git checkout feature
 80: Switched to branch 'feature'
 81: 
 82: First we will squash the three commits on feature branch into one:
 83: 
 84: C:\Users\wpollock\Desktop\Java\rebasedemo.git>type ReadMe.txt
 85: This is a sample file                     Made change 1 in feature branch
 86: with several lines in it,                 Made change 2 in feature branch
 87: used to illustrate various Git commands.  Made change 3 in feature branch
 88: 
 89: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git rebase -i HEAD~3
 90: 
 91: ========================================================================
 92: Editor opens with rebasing script.  Make changes to two lines (replace
 93: "pick" with "squash":
 94: 
 95: pick 0b5519a changed line 1
 96: squash 7be1233 changed line 2
 97: squash f1838d7 changed line 3
 98: 
 99: # Rebase cabfd05..f1838d7 onto cabfd05 (3 commands)
100: #
101: # Commands:
102: # p, pick <commit> = use commit
103: # r, reword <commit> = use commit, but edit the commit message
104: # e, edit <commit> = use commit, but stop for amending
105: # s, squash <commit> = use commit, but meld into previous commit
106: # f, fixup <commit> = like "squash", but discard this commit's log message
107: # x, exec <command> = run command (the rest of the line) using shell
108: # b, break = stop here (continue rebase later with 'git rebase --continue')
109: # d, drop <commit> = remove commit
110: # l, label <label> = label current HEAD with a name
111: # t, reset <label> = reset HEAD to a label
112: # m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
113: # .       create a merge commit using the original merge commit's
114: # .       message (or the oneline, if no original merge commit was
115: # .       specified). Use -c <commit> to reword the commit message.
116: #
117: # These lines can be re-ordered; they are executed from top to bottom.
118: #
119: # If you remove a line here THAT COMMIT WILL BE LOST.
120: #
121: # However, if you remove everything, the rebase will be aborted.
122: #
123: 
124: (After saving and exiting the editor, the script runs.  It opens the
125: editor at the end to allow you to create a new commit message, showing
126: the three that will be replace.  Make your changes, save, and exit.)
127: =========================================================================
128: 
129: [detached HEAD bf37a10] changed lines 1 to 3
130:  Date: Tue Feb 9 03:09:40 2021 -0500
131:  1 file changed, 3 insertions(+), 3 deletions(-)
132: Successfully rebased and updated refs/heads/feature.
133: 
134: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git status
135: On branch feature
136: nothing to commit, working tree clean
137: 
138: C:\Users\wpollock\Desktop\Java\rebasedemo.git>type ReadMe.txt
139: This is a sample file                     Made change 1 in feature branch
140: with several lines in it,                 Made change 2 in feature branch
141: used to illustrate various Git commands.  Made change 3 in feature branch
142: 
143: 
144: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git mylog
145: * Commit: bf37a10, Parent(s): cabfd05, Author: Wayne, Date: Tue Feb 9 03:09:40 2021 -0500  (HEAD -> feature)
146: | changed lines 1 to 3
147: |
148: |
149: | * Commit: 2e4d0bb, Parent(s): cabfd05, Author: Wayne, Date: Tue Feb 9 03:12:22 2021 -0500  (master)
150: |/  Added two lines at end
151: |
152: |
153: * Commit: cabfd05, Parent(s): , Author: Wayne, Date: Tue Feb 9 03:08:17 2021 -0500
154:   Initial Commit
155: 
156: 
157: (Notice how the three old commits on branch feature have been replaced with
158: one new one!)
159: 
160: 
161: The one commit can easily be reviewed with a pull request or patch.  Once
162: approved, it needs to be merged into the main branch (since in this example,
163: another commit was added to the main branch just to demonstrate the merge):
164: 
165: 
166: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git checkout master
167: Switched to branch 'master'
168: 
169: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git status
170: On branch master
171: nothing to commit, working tree clean
172: 
173: C:\Users\wpollock\Desktop\Java\rebasedemo.git>type ReadMe.txt
174: This is a sample file
175: with several lines in it,
176: used to illustrate various Git commands.
177: 
178: Added some lines in master branch.
179: 
180: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git merge feature
181: Auto-merging ReadMe.txt
182: CONFLICT (content): Merge conflict in ReadMe.txt
183: Automatic merge failed; fix conflicts and then commit the result.
184: 
185: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git mergetool
186: Merging:
187: ReadMe.txt
188: 
189: Normal merge conflict for 'ReadMe.txt':
190:   {local}: modified file
191:   {remote}: modified file
192: 
193: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git status
194: On branch master
195: All conflicts fixed but you are still merging.
196:   (use "git commit" to conclude merge)
197: 
198: Changes to be committed:
199:         modified:   ReadMe.txt
200: 
201: Untracked files:
202:   (use "git add <file>..." to include in what will be committed)
203:         ReadMe.txt.orig
204: 
205: 
206: C:\Users\wpollock\Desktop\Java\rebasedemo.git>del ReadMe.txt.orig
207: 
208: C:\Users\wpollock\Desktop\Java\rebasedemo.git>type ReadMe.txt
209: This is a sample file                     Made change 1 in feature branch
210: with several lines in it,                 Made change 2 in feature branch
211: used to illustrate various Git commands.  Made change 3 in feature branch
212: 
213: Added some lines in master branch.
214: 
215: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git add .
216: 
217: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git commit -m "rebasing feature branch onto main branch, squashing 3 commits into 1."
218: [master 28da2dc] rebasing feature branch onto main branch, squashing 3 commits into 1.
219: 
220: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git status
221: On branch master
222: nothing to commit, working tree clean
223: 
224: C:\Users\wpollock\Desktop\Java\rebasedemo.git>git mylog
225: *   Commit: 28da2dc, Parent(s): 2e4d0bb bf37a10, Author: Wayne, Date: Tue Feb 9 03:19:28 2021 -0500  (HEAD -> master)
226: |\  rebasing feature branch onto main branch, squaching 3 commits into 1.
227: | |
228: | |
229: | * Commit: bf37a10, Parent(s): cabfd05, Author: Wayne, Date: Tue Feb 9 03:09:40 2021 -0500  (feature)
230: | | changed lines 1 to 3
231: | |
232: | |
233: * | Commit: 2e4d0bb, Parent(s): cabfd05, Author: Wayne, Date: Tue Feb 9 03:12:22 2021 -0500
234: |/  Added two lines at end
235: |
236: |
237: * Commit: cabfd05, Parent(s): , Author: Wayne, Date: Tue Feb 9 03:08:17 2021 -0500
238:   Initial Commit
239: 
240: 
241: (Notice the "diamond" in the history, showing the successful merge.  Here's
242: the final version of the file
243: 
244: C:\Users\wpollock\Desktop\Java\rebasedemo.git>type ReadMe.txt
245: This is a sample file                     Made change 1 in feature branch
246: with several lines in it,                 Made change 2 in feature branch
247: used to illustrate various Git commands.  Made change 3 in feature branch
248: 
249: Added some lines in master branch.
250: 
251: C:\Users\wpollock\Desktop\Java\rebasedemo.git>