From 66bd0c80978e0a4ecb06753e8ee6f5fc2046be2d Mon Sep 17 00:00:00 2001 From: NoahV17 Date: Sat, 30 Sep 2023 17:42:42 -0400 Subject: [PATCH 1/4] updated- q --- notes/2023-09-26.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/notes/2023-09-26.md b/notes/2023-09-26.md index 1ee4062..6f56ab5 100644 --- a/notes/2023-09-26.md +++ b/notes/2023-09-26.md @@ -40,4 +40,7 @@ References until the full notes are added: Use an issue to submit a question for today, or make a PR to post a question and the best answer you can find (I'll review and fix if needed before posting) for a community badge. +Q: My question for today's class is if you can use reset to go forward in time commit-wise. For example, if you reset too far back, can you go back to a more recent commit. + +A: The best answer I can find is that you can revert back to a more recent commit after resetting to an older one. I also read that there is a chance git does some cleanup after a few days and deltes the commits that come after the time of the reset, making going forward in time impossible. This might only be in edge cases though. ``` \ No newline at end of file From cd383e3101bac3a81f3a30762cc12e76f444ad33 Mon Sep 17 00:00:00 2001 From: NoahV17 Date: Sat, 30 Sep 2023 17:50:12 -0400 Subject: [PATCH 2/4] added question about resets --- notes/2023-09-26.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/notes/2023-09-26.md b/notes/2023-09-26.md index 6f56ab5..f454329 100644 --- a/notes/2023-09-26.md +++ b/notes/2023-09-26.md @@ -42,5 +42,6 @@ Use an issue to submit a question for today, or make a PR to post a question and Q: My question for today's class is if you can use reset to go forward in time commit-wise. For example, if you reset too far back, can you go back to a more recent commit. -A: The best answer I can find is that you can revert back to a more recent commit after resetting to an older one. I also read that there is a chance git does some cleanup after a few days and deltes the commits that come after the time of the reset, making going forward in time impossible. This might only be in edge cases though. +A: The best answer I can find is that you can revert back to a more recent commit after resetting to an older one. I also read that there is a chance git does some cleanup after a few days and deltes the commits that come after the time of the reset, making going forward in time impossible. This might only be in edge cases though. + ``` \ No newline at end of file From 4a78cc805f74c0200cf24de4f3fdc8878f512d1c Mon Sep 17 00:00:00 2001 From: NoahV17 Date: Thu, 5 Oct 2023 16:50:19 -0400 Subject: [PATCH 3/4] syntax fix notes/2023-09-26.md Co-authored-by: Sarah Brown --- notes/2023-09-26.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/notes/2023-09-26.md b/notes/2023-09-26.md index f454329..c11ad29 100644 --- a/notes/2023-09-26.md +++ b/notes/2023-09-26.md @@ -40,8 +40,8 @@ References until the full notes are added: Use an issue to submit a question for today, or make a PR to post a question and the best answer you can find (I'll review and fix if needed before posting) for a community badge. -Q: My question for today's class is if you can use reset to go forward in time commit-wise. For example, if you reset too far back, can you go back to a more recent commit. +``` +### Can use reset to go forward in time commit-wise. For example, if you reset too far back, can you go back to a more recent commit? -A: The best answer I can find is that you can revert back to a more recent commit after resetting to an older one. I also read that there is a chance git does some cleanup after a few days and deltes the commits that come after the time of the reset, making going forward in time impossible. This might only be in edge cases though. +The best answer I can find is that you can revert back to a more recent commit after resetting to an older one. I also read that there is a chance git does some cleanup after a few days and deltes the commits that come after the time of the reset, making going forward in time impossible. This might only be in edge cases though. -``` \ No newline at end of file From 7cf1912c7dc3d0555d4df178bbe92374a695466a Mon Sep 17 00:00:00 2001 From: NoahV17 Date: Mon, 9 Oct 2023 15:26:23 -0400 Subject: [PATCH 4/4] Update notes/2023-09-26.md Co-authored-by: Sarah Brown --- notes/2023-09-26.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/notes/2023-09-26.md b/notes/2023-09-26.md index c11ad29..850d2f3 100644 --- a/notes/2023-09-26.md +++ b/notes/2023-09-26.md @@ -43,5 +43,7 @@ Use an issue to submit a question for today, or make a PR to post a question and ``` ### Can use reset to go forward in time commit-wise. For example, if you reset too far back, can you go back to a more recent commit? -The best answer I can find is that you can revert back to a more recent commit after resetting to an older one. I also read that there is a chance git does some cleanup after a few days and deltes the commits that come after the time of the reset, making going forward in time impossible. This might only be in edge cases though. +Yes if you notice right away, the objects are still there and you can get them back. If you run many porcelain commands after the erroneous `reset` git may run [garbage collection](https://git-scm.com/docs/git-gc) to optimize performance and remove any unreachable objects. It traces the commit history, logs which objects are in there, and reachable there, including branches, and then deletes remaining objects that are not reachable in any ways. + +This would only apply, however, if you were reseting all relevant branches, not if you reset one branch but leave the commits on another, because in the latter case, they commits would still be reachable.