相关疑难解决方法(0)

我怎样才能存储特定文件?

可能重复:
如何仅存储已更改的多个文件中的一个文件

如何保存特定文件,将当前已修改的其他文件保存在我要保存的存储区中?

例如,如果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 git-stash

1422
推荐指数
10
解决办法
57万
查看次数

Git checkout双重破折号的含义

这个git命令中文件名之前的双破折号是什么意思?

git checkout --ours -- path/to/file.txt
git checkout --theirs -- path/to/file.txt
Run Code Online (Sandbox Code Playgroud)

这是强制性的吗?它等同于

git checkout --ours path/to/file.txt
git checkout --theirs path/to/file.txt
Run Code Online (Sandbox Code Playgroud)

git git-checkout

253
推荐指数
2
解决办法
3万
查看次数

如何通过创建修补程序将文件夹还原到特定提交

这是我的文件夹'somefolder'的历史

$ git log somefolder

commit 89cd
More changes to somefolder

commit ef47a
Updating somefolder and other stuff

commit e095
Bugs fixed in somefolder
Run Code Online (Sandbox Code Playgroud)

我想将一些文件夹还原为"在某个文件夹中修复的错误"提交.

由于第二次提交涉及到某些文件夹之外的更改,因此我不想还原此提交.

我想最安全的方法是在commit e095和89cd之间创建一个仅适用于某个文件夹的diff/patch,然后应用该补丁.我怎样才能做到这一点?

git

90
推荐指数
2
解决办法
5万
查看次数

标签 统计

git ×3

git-checkout ×1

git-stash ×1