![]() ![]() This will save all local modifications and revert the working directory to match the HEAD commit: $ git stash Saved working directory and index state WIP on staging: e3c11da Changes date Alternatively, you can use git stash if you want to call the command without further arguments. To record the current state of your work including the Git index, simply type git stash push. So, let’s solve this and stash the local changes. The above error message tells you that the file agency.css has been modified locally and that, at the same time, the branch you’re trying to merge in also contains changes in that file - a typical merge conflict. Git is clever, so it sometimes tells you to clean up and suggests that you stash your changes: error: Your local changes to the following files would be overwritten by merge: css/agency.css Please commit your changes or stash them before you merge. before you pull remote changes to your local repo.before you check out a different branch.Creating a new Stash is a good idea and strongly recommended So, when is the perfect time to create a Stash in Git? Well, the general answer is: whenever you need a clean working copy. This article gives an introduction to git stash and shows how to avoid messy Git situations - it’s time to clean up. At any later point you can bring back or discard the changes, you can reapply them to a different branch or even create a new branch based on those changes. It saves code changes temporarily and clears your working directory for a fresh start. How can you get a clean working copy? Git is here to help: meet git stash, a clipboard for your favorite version control system. On the other hand, you’re not quite ready to commit your half-finished changes. In any case, it’s time to interrupt what you’re doing and deal with the current situation. Maybe you’ve been there: happily coding and working on some shiny new feature - and then the phone rings or an email pops up with an important customer request that can’t wait, or, even worse, a nasty bug stops an application from working. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |