How can I remove all files in my git repo and update/push from my local git repo?

后端 未结 14 2054
猫巷女王i
猫巷女王i 2021-01-29 20:20

Is it possible to remove all files in a repository and update it with only the files I have in my local machine? The reason is that, there are certain files that is not necessar

14条回答
  •  误落风尘
    2021-01-29 21:14

    First of all, Navigate to your Folder using cd ( change directory) command. Then make sure you are in the correct git branch which you want to work by using the command

    git branch
    

    If you want to delete the entire files. you can do the same by using

    git rm -r .

    for deleting a single file,

    git rm file1.txt ( file1.txt - file Name )

    for delete a folder,

    git rm -r foldername

    After deleting the files or folders, you should commit it:

    git commit -m "your comment"
    

    Then you can push the branch:

    git push
    // for example, 
    git push origin develop
    

    (it will update the origin repository)

提交回复
热议问题