I am working with git developing a feature, for this I have created a topic/1 branch
The development of this feature has been stopped, as I am waiting for a response I have a lot of changes in my working directory that are temporary things, that I don't want to save in a commit but I also don't want to lose when I go back to developing topic/1
How could I switch to a new topic/2 branch, and when I go back to topic/1, return to the working directory as I left it? I would like to keep the branch display clean and avoid adding temporary commits.
Keep in mind that this situation can happen when doing topic/2. Example I got a response from topic/1, I want to freeze topic/2 and unfreeze topic/1 without losing the changes in the working directory and keeping the commit tree clean
What would be the correct way to approach this workflow?
git stash should do what you want. It stores any changes that you currently have, without advancing your branch.
git stash
Later when you get back to you branch and want to restore the files in your working directory.
git stash pop
If you do multiple stashes you need to be a little careful which one you restore but you can find more information on that in the git doc
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.