Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.4k points)

I am looking to split a commit up and not sure which reset option to use.

I was looking at the page Can you explain what "git reset" does in plain English?, but I realized I don't really understand what the git index or staging area is and thus the explanations didn't help.

Also the use cases for --mixed and --soft look the same to me in that answer (when you want to fix and recommit.) Can someone break it down even more? I realize --mixed is probably the option to go with, but I want to know why. Lastly, what about --hard?

Can someone give me a workflow example of how selecting the 3 options would happen?

1 Answer

0 votes
by (27.5k points)

When you use --soft parameter: Git will reset all uncommitted changes. But changes are left staged (index).

When you use --mixed (default)parameter:  Git will reset all uncommitted changes as well as unstaged changes. But changes are left in working tree.

Wen you use --hard parameter: Git will reset all uncommitted changes, unstaged ones, as well as deleted changes, nothing's left.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...