可能重复:
如何仅存储已更改的多个文件中的一个文件
如何保存特定文件,将当前已修改的其他文件保存在我要保存的存储区中?
例如,如果git status给我这个:
younker % gst
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
# 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: app/controllers/cart_controller.php
# modified: app/views/cart/welcome.thtml
#
no changes added to commit (use "git add" and/or "git commit -a")
Run Code Online (Sandbox Code Playgroud)
我只想藏匿app/views/cart/welcome.thtml,我该怎么做?有点像(但当然这不起作用):
git stash save welcome_cart app/views/cart/welcome.thtml
Run Code Online (Sandbox Code Playgroud) 我对文件进行了更改,加上一个新文件,并希望在切换到另一个任务时使用git stash将它们删除.但git stash本身只会隐藏对现有文件的更改; 新文件仍然存在于我的工作树中,使我未来的工作变得混乱.如何存放这个未跟踪的文件?