git操作---git stash
git stash内容待补充!!!
git stash
git stash作用:临时保存当前修改内容。
使用场景:切换到其他分支或者在当前分支进行其他功能验证时并且需要屏蔽当前修改内容,待完成新任务后可再次返回原来工作继续开发。
1、git stash
git stash:保存修改内容
Administrator@PC201906021046 MINGW32 /d/Git_repository/Git_hub/20201212-git-test-one/git_test (master)
$ git status
On branch master
Your branch is up to date with 'origin/master'.Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: software_version.txtno changes added to commit (use "git add" and/or "git commit -a")
Administrator@PC201906021046 MINGW32 /d/Git_repository/Git_hub/20201212-git-test-one/git_test (master)
$ git stash
Saved working directory and index state WIP on master: 72ab73f update submodule againAdministrator@PC201906021046 MINGW32 /d/Git_repository/Git_hub/20201212-git-test-one/git_test (master)
$ git status
On branch master
Your branch is up to date with 'origin/master'.nothing to commit, working tree clean
2、git stash pop
git stash pop:恢复修改内容
Administrator@PC201906021046 MINGW32 /d/Git_repository/Git_hub/20201212-git-test-one/git_test (master)
$ cat software_version.txt
release_3
#software version : 6.0.0
V6
version_new_add
software 13
sotware 12
software 9Administrator@PC201906021046 MINGW32 /d/Git_repository/Git_hub/20201212-git-test-one/git_test (master)
$ git stash pop
On branch master
Your branch is up to date with 'origin/master'.Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: software_version.txtno changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/stash@{0} (6a02b9878e9a2803fd06dfaa70865c50590be554)Administrator@PC201906021046 MINGW32 /d/Git_repository/Git_hub/20201212-git-test-one/git_test (master)
$ cat software_version.txt
release_3
#software version : 6.0.0
V6
version_new_add
software 13
sotware 12
software 9
software 10Administrator@PC201906021046 MINGW32 /d/Git_repository/Git_hub/20201212-git-test-one/git_test (master)
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)