question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Learn Git Lesson gives incorrect definition of soft and medium resets

See original GitHub issue

Describe the Issue

There’s a definition in a Relational Database Learn Git lesson that is not strictly correct. This instruction is given:

I’m going to show you a few ways to remove or undo a commit. The first is to simply “travel back in time”. You can use the git reset command to travel to any point in your commit history. Your current HEAD is a reference to the last commit you just made. Use git reset HEAD~1 to go back one before HEAD .

The problem is the next instruction which says:

This is a “soft” reset and will put the changes from the commit you undid in your working tree. You can see that it says there’s unstaged changes after the reset to your file…

This was not a “soft” reset. This was a “medium” reset. --medium is the default. --soft would leave changes in the staging area.

The original author probably indended “soft” meaning “not hard” but “soft” has a very specific meaning here.

Affected Page

https://www.freecodecamp.org/learn/relational-database/learn-git-by-building-an-sql-reference-object/build-an-sql-reference-object

Your code

git reset HEAD~1

Expected behavior

I expect to be taught that git reset HEAD~1 is equivalent to git reset --medium HEAD~1, NOT git reset --soft HEAD~1 as the lesson suggests

Screenshots

No response

System

  • Device: HP laptop
  • OS: 5.18.0-kali7-amd64
  • Browser: Chrome
  • Version: Latest

Additional context

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Ayush-singla27commented, Oct 26, 2022

@nayabatir1 My PR have been merged. I think this issue will soon be closed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Clarify soft vs medium git resets #15 - GitHub
My pull request has a descriptive title (not a vague title like Update index.md ). Closes #48079. The first commit corrects the language...
Read more >
What's the difference between git reset --mixed, --soft, and
--soft: Deleted changes only from the local repository. It won't touch the staging area and working directory. Possible to revert back changes ...
Read more >
Git & Github Complete Tutorial | Learn Git in 2 hrs | Simplilearn
This video on Git Tutorial for beginners will help you learn about one of the most popular version control systems, i.e., ...
Read more >
Git Tutorial For Beginners | Git Crash Course | Simplilearn
This video on Git Tutorial for Beginners will help you learn about the most popular source code management tool used in DevOps.
Read more >
Soft, mixed and hard resets in SourceTree | by Ajita Gupta
Soft commit​​ Soft commits set your HEAD back to the selected commit. They keep all the changes. The staging area contains the changes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found