git暂存区


user@DESKTOP-K146JU9 /path/to/project
> git st
On branch test
Your branch is up-to-date with 'origin/test'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   path/to/class.inc.php

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

user@DESKTOP-K146JU9 /path/to/project
> git stash
Saved working directory and index state WIP on test: 3e5414cd4c4 tiaoshi

user@DESKTOP-K146JU9 /path/to/project
> git st
On branch test
Your branch is up-to-date with 'origin/test'.

nothing to commit, working tree clean

user@DESKTOP-K146JU9 /path/to/project
> git ck autoba
Switched to branch 'autoba'
Your branch is up-to-date with 'origin/autoba'.

user@DESKTOP-K146JU9 /path/to/project
> git ck test
Switched to branch 'test'
Your branch is up-to-date with 'origin/test'.

user@DESKTOP-K146JU9 /path/to/project
> git stash apply
On branch test
Your branch is up-to-date with 'origin/test'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   path/to/class.inc.php

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

可以创建别名

user@DESKTOP-K146JU9 /path/to/project
> git config --global alias.s "stash"

user@DESKTOP-K146JU9 /path/to/project
> git config --global alias.r "stash apply"

user@DESKTOP-K146JU9 /path/to/project
> git s
Saved working directory and index state WIP on test: 3e5414cd4c4 测试

user@DESKTOP-K146JU9 /path/to/project
> git st
On branch test
Your branch is up-to-date with 'origin/test'.

nothing to commit, working tree clean

user@DESKTOP-K146JU9 /path/to/project
> git r
On branch test
Your branch is up-to-date with 'origin/test'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   path/to/class.inc.php

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

参考文档


Author: Itaken
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint polocy. If reproduced, please indicate source Itaken !
  TOC目录