Rename file with Git

前端 未结 6 1810
忘了有多久
忘了有多久 2021-01-29 20:12

I\'m new to Git/Github and I needs some help. I would like to rename file from README to README.md. I have only one repo called \"change-z-index\".

1) I open and login l

6条回答
  •  既然无缘
    2021-01-29 20:32

    You can rename a file using git's mv command:

    $ git mv file_from file_to
    

    Example:

    $ git mv helo.txt hello.txt
    
    $ git status
    # On branch master
    # Changes to be committed:
    #   (use "git reset HEAD ..." to unstage)
    #
    #   renamed:    helo.txt -> hello.txt
    #
    
    $ git commit -m "renamed helo.txt to hello.txt"
    [master 14c8c4f] renamed helo.txt to hello.txt
     1 files changed, 0 insertions(+), 0 deletions(-)
     rename helo.txt => hello.txt (100%)
    

提交回复
热议问题