开发设计方法

lxf2023-05-04 04:58:01

开发设计方法-Git

git stash 使用方法汇总

1)git stash save "save message"  : 实行存放时,添加备注,便捷搜索,仅有git stash 也需要没问题的,但搜索的时候不便捷鉴别。

$ git stash save "one"
$ git stash save "two"
2)git stash list  :查询stash了什么存放

$ git stash list
stash@{0}: On develop-20211012-V1.0.2-SuZhouBus: two
stash@{1}: On develop-20230414-v1.1.0: one
3)git stash show :表明做了哪些修改,默认设置show第一个存放,如果想表明别的存储,后面加stash@{$num},例如第二个 git stash show stash@{1}

// 默认设置表明 0 的修改
$ git stash show
 src/store/modules/app.js | 2  -
 1 file changed, 1 insertion( ), 1 deletion(-)
// 表明 1 的修改
 $ git stash show stash@{1}
 src/store/modules/app.js | 2  -
 1 file changed, 1 insertion( ), 1 deletion(-)
4)git stash show -p : 表明第一个保存的修改,如果要表明别的存存放,指令:git stash show  stash@{$num}  -p ,例如第二个:git stash show  stash@{1}  -p

// 表明 苏州公交 的修改
$ git stash show -p
diff --git a/src/store/modules/app.js b/src/store/modules/app.js
index 8a5f055..fc4902c 100644
--- a/src/store/modules/app.js
    b/src/store/modules/app.js
@@ -11,7  11,7 @@ const state = {
   device: 'desktop',
   isIE: isIE()
 }
-
 console.log('我就是苏州公交的修改');
 const mutations = {
   TOGGLE_SIDEBAR: state => {
     state.sidebar.opened = !state.sidebar.opened
// 表明 基准线 的修改
$ git stash show  stash@{1}  -p
diff --git a/src/store/modules/app.js b/src/store/modules/app.js
index 8a5f055..2f93016 100644
--- a/src/store/modules/app.js
    b/src/store/modules/app.js
@@ -11,7  11,7 @@ const state = {
   device: 'desktop',
   isIE: isIE()
 }
-
 console.log('我就是基准线的修改');
 const mutations = {
   TOGGLE_SIDEBAR: state => {
     state.sidebar.opened = !state.sidebar.opened
5)git stash apply :运用某一存放,但不把存放从存储页面上删掉,默认设置应用第一个存放,即stash@{0},如果想用其他个,git stash apply stash@{$num} , 例如第二个:git stash apply stash@{1} 

// 将苏州公交自身的修改添充
$ git stash apply
On branch develop-20211012-V1.0.2-SuZhouBus
Your branch is up to date with 'origin/develop-20211012-V1.0.2-SuZhouBus'.

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:   src/store/modules/app.js

no changes added to commit (use "git add" and/or "git commit -a")

// 将基准线的修改添充
$ git stash apply stash@{1} 
On branch develop-20211012-V1.0.2-SuZhouBus
Your branch is up to date with 'origin/develop-20211012-V1.0.2-SuZhouBus'.

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:   src/store/modules/app.js

no changes added to commit (use "git add" and/or "git commit -a")
6)git stash pop :指令修复以前缓存文件的工作目录,将缓存文件局部变量里的相匹配stash删掉,并把相匹配改动运用到现阶段的工作目录下,默认第一个stash,即stash@{0},如果想运用并删掉别的stash,指令:git stash pop stash@{$num} ,例如运用并删掉第二个:git stash pop stash@{1}

// 默认设置修复 0 的修改
$ git stash pop
On branch develop-20211012-V1.0.2-SuZhouBus
Your branch is up to date with 'origin/develop-20211012-V1.0.2-SuZhouBus'.

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:   src/store/modules/app.js

no changes added to commit (use "git add" and/or "git commit -a")

// 修复 1 的修改
$ git stash pop stash@{1}
On branch develop-20230414-v1.1.0
Your branch is up to date with 'origin/develop-20230414-v1.1.0'.

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:   src/store/modules/app.js

no changes added to commit (use "git add" and/or "git commit -a")
Dropped stash@{1} (7003049680892963ac488ffb7a8c551b5b003400)
7)git stash drop stash@{$num} :丢掉stash@{$num}存放,从页面上删除这个存放
8)git stash clear :删除全部缓存文件的stash

参考链接: www.cnblogs.com/zndxall/arc…