9/6/2023 0 Comments Git reset headPerforming restore on the staged changes would only undo what's about to be committed and not infer any loss of data, as the change itself is also present in the Working Tree (notice the "bar" line in index.js). Take a look at the below example illustrating a dirty Working Tree including changes staged for commit. And just like the official documentation states, restore doesn't update your branch (i.e. If, and when, that happens, restore is your weapon of choice.Īlthough restore has a multitude of use cases, in its simplest form it's used to remove changes from the Staging Area, or to discard changes made to your Working Tree. Not doing so might cause you to add files by accident which you don't want to commit. isn't something I'd recommend doing, as it's generally better to be more selective in what files to stage. ➕ Removing an accidentally staged file (restore) With the general command description from above top of mind, let's see how they differ in reality. Ok, still not crystal clear? Let's contextualize the above statements and solve our initial problems using them. " revert is about making a new commit that reverts the changes made by other commits.".The command can also be used to restore files in the index from another commit." This command does not update your branch.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |