-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lesson8, ex2 and ex3 reference solutions (first pass)
- Loading branch information
Showing
2 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
$ git log --oneline | head -3 | ||
b3b78b5 rebase interactive commit3 | ||
99cc38a rebase interactive commit2 | ||
e658aba rebase interactive commit1 | ||
|
||
$ git rebase -i HEAD~3 | ||
|
||
Rebase interactive editor--select 'reword' | ||
----- EDITOR ----- | ||
1 pick e658aba rebase interactive commit1 | ||
2 reword 99cc38a rebase interactive commit2 | ||
3 pick b3b78b5 rebase interactive commit3 | ||
------------------ | ||
|
||
Editor to actually change the commit message | ||
----- EDITOR ----- | ||
rebase interactive commit2 (modified) | ||
------------------ | ||
|
||
$ git rebase -i HEAD~3 | ||
[detached HEAD 2d343be] rebase interactive commit2 (modified) | ||
Date: Tue Jul 9 12:42:46 2024 -0700 | ||
1 file changed, 3 insertions(+), 1 deletion(-) | ||
Successfully rebased and updated refs/heads/main. | ||
|
||
|
||
$ git rebase -i HEAD~3 | ||
|
||
Rebase interactive editor--select 'edit' | ||
----- EDITOR ----- | ||
1 pick e658aba rebase interactive commit1 | ||
2 pick 2d343be rebase interactive commit2 (modified) | ||
3 edit 06b5feb rebase interactive commit3 | ||
------------------ | ||
|
||
[.venv] ktbyers@pydev2 ~/gne_exercises/lesson8 | ||
$ git add test_file.py | ||
|
||
[.venv] ktbyers@pydev2 ~/gne_exercises/lesson8 | ||
$ git commit --amend | ||
|
||
Editor to change the commit message (as part of the amend process) | ||
----- EDITOR ----- | ||
1 rebase interactive commit3 (amended test_file.py) | ||
------------------ | ||
|
||
$ git rebase --continue | ||
Successfully rebased and updated refs/heads/main. | ||
|
||
|
||
|
||
$ git rebase -i HEAD~3 | ||
Rebase interactive editor--select 'squash' | ||
----- EDITOR ----- | ||
1 pick e658aba rebase interactive commit1 | ||
2 squash 2d343be rebase interactive commit2 (modified) | ||
3 pick 6d7dd41 rebase interactive commit3 (amended test_file.py) | ||
|
||
|
||
----- EDITOR ----- | ||
rebase interactive commit1 & commit2 (modified) | ||
|
||
|
||
$ git log --oneline | head -2 | ||
45c93e9 rebase interactive commit3 (amended test_file.py) | ||
bf11eb1 rebase interactive commit1 & commit2 (modified) | ||
|
||
|
||
|
||
|
||
git rebase -i HEAD~3 | ||
|
||
Rebase interactive editor--select 'squash' | ||
----- EDITOR ----- | ||
1 pick bf11eb1 rebase interactive commit1 & commit2 (modified) | ||
2 pick 45c93e9 rebase interactive commit3 (amended test_file.py) | ||
3 drop 7636b66 rebase interactive commit4 | ||
|
||
$ !1050 | ||
git rebase -i HEAD~3 | ||
Successfully rebased and updated refs/heads/main. | ||
|
||
$ git log --oneline | head -3 | ||
45c93e9 rebase interactive commit3 (amended test_file.py) | ||
bf11eb1 rebase interactive commit1 & commit2 (modified) | ||
fd0175b Adding simple solution for class8, ex1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
[.venv] ktbyers@pydev2 ~/gne_exercises/lesson8 | ||
$ vi reflog.txt | ||
|
||
[.venv] ktbyers@pydev2 ~/gne_exercises/lesson8 | ||
$ git add reflog.txt | ||
|
||
[.venv] ktbyers@pydev2 ~/gne_exercises/lesson8 | ||
$ git commit -m "Testing git reflog1" | ||
[main 205affc] Testing git reflog1 | ||
1 file changed, 1 insertion(+) | ||
create mode 100644 lesson8/reflog.txt | ||
|
||
[.venv] ktbyers@pydev2 ~/gne_exercises/lesson8 | ||
$ vi reflog.txt | ||
|
||
[.venv] ktbyers@pydev2 ~/gne_exercises/lesson8 | ||
$ git add reflog.txt | ||
|
||
[.venv] ktbyers@pydev2 ~/gne_exercises/lesson8 | ||
$ git commit -m "Testing git reflog2" | ||
[main e5bd02b] Testing git reflog2 | ||
1 file changed, 1 insertion(+) | ||
|
||
[.venv] ktbyers@pydev2 ~/gne_exercises/lesson8 | ||
$ git log --oneline | head -4 | ||
e5bd02b Testing git reflog2 | ||
205affc Testing git reflog1 | ||
45c93e9 rebase interactive commit3 (amended test_file.py) | ||
bf11eb1 rebase interactive commit1 & commit2 (modified) | ||
|
||
|
||
e5bd02b (HEAD -> main) HEAD@{0}: commit: Testing git reflog2 | ||
205affc HEAD@{1}: commit: Testing git reflog1 | ||
45c93e9 HEAD@{2}: rebase (finish): returning to refs/heads/main | ||
45c93e9 HEAD@{3}: rebase (start): checkout HEAD~3 | ||
7636b66 HEAD@{4}: commit: rebase interactive commit4 | ||
|
||
[.venv] ktbyers@pydev2 ~/gne_exercises/lesson8 | ||
$ git checkout -b l8_lost_commit 7636b66 | ||
Switched to a new branch 'l8_lost_commit' | ||
|
||
[.venv] ktbyers@pydev2 ~/gne_exercises/lesson8 | ||
$ git log --oneline | head -3 | ||
7636b66 rebase interactive commit4 | ||
45c93e9 rebase interactive commit3 (amended test_file.py) | ||
bf11eb1 rebase interactive commit1 & commit2 (modified) | ||
|
||
[.venv] ktbyers@pydev2 ~/gne_exercises/lesson8 | ||
$ git diff 45c93e9 7636b66 | ||
diff --git a/lesson8/rebase.py b/lesson8/rebase.py | ||
new file mode 100644 | ||
index 0000000..696d24a | ||
--- /dev/null | ||
+++ b/lesson8/rebase.py | ||
@@ -0,0 +1 @@ | ||
+print("Testing interactive rebasing") | ||
|
||
$ git checkout main | ||
Switched to branch 'main' | ||
Your branch is ahead of 'origin/main' by 6 commits. | ||
(use "git push" to publish your local commits) | ||
|
||
[.venv] ktbyers@pydev2 ~/gne_exercises/lesson8 | ||
$ git branch -d l8_lost_commit | ||
error: The branch 'l8_lost_commit' is not fully merged. | ||
If you are sure you want to delete it, run 'git branch -D l8_lost_commit'. | ||
|
||
[.venv] ktbyers@pydev2 ~/gne_exercises/lesson8 | ||
$ git branch -D l8_lost_commit | ||
Deleted branch l8_lost_commit (was 7636b66). | ||
|