git -- workspace

Scenario assumption: When the project develops to a certain stage and a problem is found, there are three solutions, in order to explore which one is better. After plan 1 is completed, how can we go back to the initial stage to test plan 2 under the condition that plan 1 will not be added or deleted?

1. Make sure the workspace is clean
insert image description here
2. Add workspace

① 保证工作区干净
② 对项目进行修改后显示,要求add\commit,因为不能保证是最终结果,不能add\commit
③ git stash save "描述文字"   创建工作区
④ 创建工作区后,操作区状态暂时恢复干净状态
⑤ 查看工作区列表:git stash list

insert image description here
3. Application Workspace

git stash apply stash@{0} 
stash@{0}:通过工作区列表查看每个工作区对应编号

4. Delete the workspace

git stash drop stash@{0}

insert image description here
5. Determine the final plan. After applying the workspace, you need to add\commit to the warehouse

Guess you like

Origin blog.csdn.net/m0_51489557/article/details/130330285