开发者

How can i rename / delete files in git repository?

开发者 https://www.devze.com 2023-03-22 04:09 出处:网络
I created a git repository projecteuler-solutions and then i wanted to remove the word Euler from the file names so i renamed the files to just numbers and added the renamed files using an add command

I created a git repository projecteuler-solutions and then i wanted to remove the word Euler from the file names so i renamed the files to just numbers and added the renamed files using an add command and then commited and pushed the changes , but even though in the status the file names with a euler prefix were ma开发者_C百科rked as D they didn't get deleted , how can i delete those files now and what is the usual flow to rename the files ?


Removal: git rm
Renaming: git mv


You can delete those files by using git rm:

git rm euler10.py

Normally you would use git mv to rename/move files:

git mv oldfilename newfilename


Go ahead and rename in whatever way you are used to in your file system. Now you need to add all the changes. your rename is seen as a delete and an add.

git add -A

will be shown as a move. You can see this by running

git status

This workflow will allow you to not worry about git commands and concentrate on your work.

hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号