【问题标题】:Android Studio remove files on local and remote repositoryAndroid Studio 删除本地和远程存储库中的文件
【发布时间】:2021-06-15 07:34:05
【问题描述】:

意外提交 google-services.json 文件,我想在本地和远程仓库中删除它,而不会使用最新的 Android Studio Arctic Fox 破坏任何内容。稍后将在完成后将此文件添加到.gitignore。如何做到这一点?

【问题讨论】:

标签: android git android-studio version-control


【解决方案1】:

我不想删除本地设备中的文件,而是将其从本地和远程存储库中删除。

然后:

git rm --cached google-services.json
echo google-services.json>../.gitignore
git add .gitignore
git commit -m "Record google-services.json deletion, and ignores it"
git push

由于rm --cached 选项,该文件仍将存在于本地。

【讨论】:

  • 如果我之前已经对google-services.json进行了一些更改,然后执行这些命令呢?我最近对 ​​json 文件所做的更改会受到影响还是不会有任何改变?
猜你喜欢
  • 2020-10-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-04-24
  • 2014-06-04
  • 2014-11-19
  • 2017-06-17
相关资源
最近更新 更多