This community-built FAQ covers the “Generalizations” exercise from the lesson “How to Backtrack”.
Paths and Courses
This exercise can be found in the following Codecademy content:
Web Development
Learn Git
FAQs on the exercise Generalizations
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply (
) below!
Agree with a comment or answer? Like (
) to up-vote the contribution!
Need broader help or resources? Head here.
Looking for motivation to keep learning? Join our wider discussions.
Learn more about how to use this guide.
Found a bug? Report it!
Have a question about your account or billing? Reach out to our customer support team!
None of the above? Find out where to ask other questions here!
Just making sure I get this, below is the summary from this lesson’s review. Is the part I added in bold is correct? Or does the reset reset your working directory version? If you wanted to leave your production/committed version alone but check out an older version to your local working directory, could you do that with git checkout commit_SHA?
Let’s take a moment to review the new commands:
-
git checkout HEAD filename
: Discards changes in the working directory.
-
git reset HEAD filename
: Unstages file changes in the staging area.
-
git reset commit_SHA
: Resets the committed/production version to a previous commit in your commit history.
Given that the main purpose of git seems to be as a version control for collaborative working. I just wished to ask when using the “git reset commit_sha” form of backtracking that subsequently removes commits after the commit stated in the command. Are these commits all of ones own, or are they commits that have been committed by other team members to the same file?
Thank you!