相关疑难解决方法(0)

如何停止跟踪并忽略Git中文件的更改?

我克隆了一个包含一些.csproj文件的项目.我不需要/喜欢我的本地csproj文件被Git跟踪(或者在创建补丁时被提起),但显然它们在项目中是必需的.

我已添加*.csproj到我的LOCAL .gitignore,但文件已经在repo中.

当我输入git status时,它会显示我csproj对跟踪或提交补丁不感兴趣的更改.

如何从我的个人仓库中删除这些文件的"跟踪"(但是将它们保存在源代码中以便我可以使用它们)以便在我执行状态(或创建补丁)时看不到更改?

是否有正确/规范的方法来处理这种情况?

git

1634
推荐指数
11
解决办法
66万
查看次数

.gitignore并不是在忽视自己

我加入的.gitignore和其他目录以我的.gitignore文件,但是当我git status,.gitignore仍然呈现了!

我觉得我错过了一些非常明显的东西.

git gitignore

11
推荐指数
1
解决办法
7030
查看次数

Git检出失败,因为本地更改...没有本地更改?

使用Git 2.7.4,我对分支进行了一些更改。提交并推送到分支。

[user:~/terraform] mybranch ± git status
On branch DIC-98-rhel-lb0
nothing to commit, working directory clean
[user:~/terraform] mybranch ±


[user:~/terraform] mybranch ± git push origin mybranch
Everything up-to-date
Run Code Online (Sandbox Code Playgroud)

当我尝试切换至主机

[user:~/terraform] mybranch ± git checkout master
error: Your local changes to the following files would be overwritten by checkout:
    azure-openshift/.gitignore
    azure-openshift/bastion.tf
    azure-openshift/bootstrap.sh
    azure-openshift/bootstrap.tfvars
    azure-openshift/cns.tf
    azure-openshift/infra.tf
    azure-openshift/master.tf
    azure-openshift/openshift.auto.tfvars
    azure-openshift/openshift.variables.tf
    azure-openshift/revproxy.tf
Please, commit your changes or stash them before you can switch branches.
Aborting
[user:~/terraform] mybranch 1 ± 
Run Code Online (Sandbox Code Playgroud)

我也可以先做git reset,得到相同的结果。

我想念什么?

git reset git-checkout

5
推荐指数
1
解决办法
564
查看次数

标签 统计

git ×3

git-checkout ×1

gitignore ×1

reset ×1