B
B
BLR_BOBR1K2014-11-14 22:58:35
git
BLR_BOBR1K, 2014-11-14 22:58:35

Git how to delete file directly in remote repository?

the task is this: to delete a file in a remote repository
, two ideas immediately came to mind
1) you need to work with https://bitbucket.org, which has a file deletion function. The teacher said to do it through git!
2) delete the file in the local repository, commit and push, actually deleted (only left in the history, but okay). The teacher said to do everything directly,
as I understand it, I need to go to the remote repository as one of the folders on my computer, and delete the file (THE EVERYTHING IS DONE DIRECTLY) The
question is how to do this ??? Work is done from https://bitbucket.org

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
Boris Benkovsky, 2014-11-14
@BLR_BOBR1K

Git can't go ahead and remove a file from a repository without creating a commit (or breaking the history). Your option #1 does just that. Bitbucket creates a commit in which it deletes the file. So, your option #2 is the correct solution.
Of course, you can delete the file from the history, but you have to overwrite the history again, but it's still done locally, and then git push --force
PS It's very interesting what your teacher wants. Tell us then "the right decision"

M
mv200580, 2014-11-16
@mv200580

git rm --cached file.txt
git commit
git push

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question