简体   繁体   中英

How can i rename / delete files in git repository?

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 marked 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM