服务器 - git 部署代码,出现untracked files的代码
阿神
阿神 2017-05-02 09:32:41
0
2
660

使用git同步代码到服务器,从特性分支切到 master 或者其他新分支,再执行 git status 提示有 untracked files ,这几个 untracked files 都是已被删除的.

[www@iZ94 fl.com]$ git status
# On branch develop
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       images/an_page_h5-06.png~HEAD
#       images/an_page_h5-06.png~HEAD_0
#       images/an_page_h5-07.png~HEAD
#       images/an_page_h5-07.png~HEAD_0
#       images/an_page_h5-08.png~HEAD
#       images/an_page_h5-08.png~HEAD_0
#       images/an_page_h5-09.png~HEAD
#       images/an_page_h5-09.png~HEAD_0
nothing added to commit but untracked files present (use "git add" to track)
[www@iZ94 fl.com]$ 

[www@iZ94 fl.com]$ git reset --hard origin master
fatal: Cannot do hard reset with paths.
[www@iZ94 fl.com]$ git reset --hard remotes/origin/develop
HEAD is now at 6ac5b22 Merge branch 'PD_MC-414_Ma1-2' into 'develop'

这几个图片文件是不需要的。本地是WIN,不区分大小写,大小写写错。提交到LINUX,区分大小写,后来改了,但缓存里面的一直无法删除掉。现在切到其他的分支就有这样的提示,使用 git reset --hard remotes/origin/master,如何才可以强制变为干净的分支。

阿神
阿神

闭关修行中......

reply all(2)
淡淡烟草味

Git reset is to restore the contents of the temporary storage area. This content is not in the temporary storage area. You can use git clean to clean it, or delete these files directly, or use git checkout to restore the contents of the workspace!

PHPzhong

Visually check that these files are generated during the running of your program. You can delete them directly. The best solution is to place the generated temporary content in some specific directories, and then add this directory to the .gitignorefile

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!