git忽略修改后的文件,所以我可以更改分支
问题描述:
我创建了一个分支“用户”,我在其中完成了包括一个.less文件在内的更改。我有一个较少的编译器打开,它会自动编译保存。当我更改为主分支时,.less文件被编译,因此我的.css文件现在在主服务器上不同。所以现在我不能在用户(包括提交)中合并或切换回用户分支。git忽略修改后的文件,所以我可以更改分支
我得到以下错误:
pathspec 'media/less/content/public/template.css' did not match any file(s) known to git.
反正我有可以撤消或者忽略文件,所以我可以在“用户”合并?
我想签的文件,但它没有工作:在
pathspec 'media/less/content/public/template.css' did not match any file(s) known to git.
答
git checkout media/less/content/public/template.css
结果可以重置一个承诺回来,然后看到更改的文件,清理和再次提交。
git reset HEAD~1
git status # you'll see the files that changed
# probably you need to do this
git checkout media/less/content/public/template.css
git commit -m "..."
git push -f # to update the last commit
这不会直接解决您的问题,但这正是导出文件不属于源代码管理的原因。 .css文件不应该被检入以开始。 – 2013-04-25 05:11:29