如果我在我的仓库上运行'git status',它会给出:
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: myfile
Run Code Online (Sandbox Code Playgroud)
但是,如果我执行'git diff myfile',它就没有显示出任何差异.这是因为我做了一个更改并将其删除,以便恢复原状吗?
我应该运行'git checkout myfile'来清除它吗?
我有一个场景,在我的本地存储库中有几个远程跟踪分支,我必须同步到.我们的工作流模型是:
我注意到"git status"并没有显示我的本地分支所基于的分支,除非某些内容发生了变化; 即未提交的本地更改或最近的提取使我的本地分支落后于时代.有没有办法知道我的本地分支基于什么分支而不必改变东西?类似于"git status -showparentbranch"或其他一些可以显示此命令的命令.偶尔我会遇到这个需求,但还不知道如何满足它.
我遇到了与此问题相同的问题:git status显示修改,git checkout - <file>不会删除它们
Git继续显示工作目录修改,即使git config --global core.autocrlf false
:
E:\_dev\github\Core [master +0 ~93 -0]> git config --get-all core.autocrlf
false
false
Run Code Online (Sandbox Code Playgroud)
(注意我甚--system
至将设置设置为false
)
为什么看起来Git仍在修改我的行尾?
E:\_dev\github\Core [master +0 ~93 -0]> git status
# On branch master
# 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: tools/StatLight/StatLight.EULA.txt
... more changes ... …
Run Code Online (Sandbox Code Playgroud) 我有一个已经添加到我的本地存储库的文件.我在工作树中对其进行了修改,因此git status
将文件显示为已修改.我想知道在暂存文件之前索引中保存的文件内容是什么.
我可以想到两种方法:
git diff
,并将其应用于工作树中的文件git checkout-index
,指向临时文件并从那里读取内容有没有更简单的方法?
我不想.class
在执行时显示文件git status
.
我创建了一个名为的文件,.gitignore
并.class
在文件中输入但没有任何反应.
.class
执行git status
命令时阻止文件显示的最佳方法是什么?
我在存储库上使用git进行源代码控制.最近它已经开始警告我在使用时枚举未跟踪文件需要多长时间git status
:
$ git status
On branch my_branch
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: My_Project/my_source.c
It took 3.24 seconds to enumerate untracked files. 'status -uno'
may speed it up, but you have to be careful not to forget to add
new files yourself (see 'git help status').
no changes added to commit (use "git add" and/or "git …
Run Code Online (Sandbox Code Playgroud) 一切都在标题中......
我读到了这个问题:查看Unpushed Git提交
但我不明白为什么git status
在master分支中显示所有未提交的提交,但在其他分支中不显示任何内容.
有人可以解释一下吗?
编辑
这是我做/得到的命令和输出:
aurelien@server:/home/repo/$ git branch
new_feature
* master
aurelien@server:/home/repo/$ git checkout new_feature
Switched to branch 'new_feature'
aurelien@server:/home/repo/$ echo test > newfile.txt
aurelien@server:/home/repo/$ git add newfile.txt
aurelien@server:/home/repo/$ git commit -m "Test commit"
[new_feature 51c6a64] Test commit
1 file added
aurelien@server:/home/repo/$ git status
# On branch new_feature
nothing added to commit
Run Code Online (Sandbox Code Playgroud)
使用时为什么我的提交没有出现git status
?
我想看看当前目录的状态.因为有很多的子目录,改变这一点我不希望看到的,下面的命令不会做的伎俩:
git status .
Run Code Online (Sandbox Code Playgroud)
有没有办法获得这种报告,而不是提高产量git status
?
当我这样做git status
时说nothing to commit, working directory clean
然后我这样做git pull --rebase
,它说:
First, rewinding head to replay your work on top of it...
error: The following untracked working tree files would be overwritten by checkout:
includes/resources/moduledata/12/_Fr4_02_Invention_IPA_SR_la-Fe?te.pdf
Please move or remove them before you can switch branches.
Aborting
could not detach HEAD
Run Code Online (Sandbox Code Playgroud)
做的时候类似的错误 git pull origin master
* branch master -> FETCH_HEAD
error: The following untracked working tree files would be overwritten by merge:
includes/resources/moduledata/12/_Fr4_02_Invention_IPA_SR_la-Fe?te.pdf
Please move or …
Run Code Online (Sandbox Code Playgroud) 当我运行时git status
,我看到"未跟踪文件"部分有许多文件(一些文件扩展名为".").
我不认为我必须做任何事情,但每次运行时都看不到这些文件git status
.有没有办法不看这些文件?