heart Posts from the community...
Story
@5minslearn shared a post, 2 years, 3 months ago

Git Checkout / Reset / Revert. When to use what?

We often come across some weird scenarios (especially my team) while committing our code changes. Some of them are,

How can I bring the file to working area, which I have added to the staging area by mistake?

OMG! I made a commit with production keys in the code but did not push the code yet. Is it possible to delete that commit? (Meanwhile, my tech lead be like 😡)

Can anyone say how to remove the changes which I’ve pushed already?

I logged onto Production machine and made a change to a file and fixed the production issue immediately 👏 (Can also be debugging on production 😜). Now, I want to remove that change using git cli for the CI/CD to pass. Any Git commands available for this purpose?

Head to the bottom of this page, if you need blind answers for these scenarios. For those who need to understand more, continue from here.

Let’s find answers to all of your such queries with just 3 commands.

1. Checkout

2. Reset

3. Revert

1_YXYpVNbCUVaoR8dkP-_Mog.png
 Activity
@5minslearn started using tool Node.js , 2 years, 3 months ago.
 Activity
@5minslearn started using tool GNU/Linux , 2 years, 3 months ago.