如何删除远程存储库中的文件? [英] how to delete files in the remote repository?
问题描述
我不确定这个问题的具体含义是什么。基本上,我需要删除一些文件&我的远程存储库上的目录
我有一个本地git repo&在github的远程回购
- 一直在自己工作。
- 一位朋友提出了一个请求。
- 我合并了他的请求(通过github界面)
- 我抽出了更改。代码并决定不进行修改(不应该在第一个地方进行合并)
- 我恢复了以前的提交 更改
- 推送到服务器。
这就是我的本地存储库时刻:
* 7e143b1(HEAD)
| \
| * 18cea0f(起源/主,起源/头,主)
| | \
| | * fc19ccf
* | | 6f3c58a
| / /
* | 8d82486
| /
| * d3ce65f(pre-install-activeadmin)
| /
* 7d0566c
* d1c77ab
* 75ba704
* 30dc67c(heroku / master)
* f89b1f6
* ea5e2db
* 08931d6
* 9773a6f
* b636aba
* cb6f8d4
我可以将我的本地存储库更改为 7d0566c
。我不确定远程仓库中的仓库指向哪里。
如何删除那些位于远程仓库但不在本地仓库中的文件?
很明显,我没有在我的本地回购库中看到他的任何文件,因为我将HEAD重置为先前的提交。但是,远程回购仍然显示他的文件。当我承诺时,它承诺很好。
我的工作流程是否错误?我应该首先测试这个补丁。任何建议?我是版本控制的新手。谢谢
从服务器拉取更改,然后执行 git rm
在您的本地回购站上,提交更改并推送到服务器。这些文件将被删除。
I am not sure what is the exact term for this problem. Basically, I need to remove some files & directory on my remote repository
I have a local git repo & remote repo in github
- Had been working myself.
- A friend made a pull request.
- I merged his request (via github interface)
- I pulled the changes.
- I tested the code and decided not to take his changes (shouldn't have merged at the first place)
- I reverted back to a previous commit
- Made some changes
- Push to the server.
This is how my local repository looks like at the moment:
* 7e143b1 (HEAD)
|\
| * 18cea0f (origin/master, origin/HEAD, master)
| |\
| | * fc19ccf
* | | 6f3c58a
|/ /
* | 8d82486
|/
| * d3ce65f (pre-install-activeadmin)
|/
* 7d0566c
* d1c77ab
* 75ba704
* 30dc67c (heroku/master)
* f89b1f6
* ea5e2db
* 08931d6
* 9773a6f
* b636aba
* cb6f8d4
I can change my local repo to 7d0566c
. I am not sure where the head on my remote repo is pointing to.
How do I remove those files that are on remote repo but are not on my local repo?
Obviously, I do not see any of his files in my local repo because I did a reset of my HEAD to a previous commit. However, the remote repo still shows his files. When I commit, it commits just fine.
Is my workflow wrong? I should have just tested the patch at the first place. Any suggestion? I am new to version control. Thank you
Pull the changes from the server, then do a git rm
on your local repo, commit the changes, and push to the server. The files will be deleted.
这篇关于如何删除远程存储库中的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!