Git Rename operation

Source: Internet
Author: User

Up to now, Tome and Jerry have used manual commands to compile their own projects. Jerry decided to create a Makefile for their project and give the appropriate name to the "string.c" file.

[Email protected] project]$ Pwd/home/jerry/jerry_repo/project

[[email protected] project]$ ls README src [[email protected] project]$ CD src/

[[email protected] src]$ git add Makefile [[email protected] src]$ git mv string.c string_operations.c

[[email protected] src]$ git status-s A Makefile R string.c−> string_operations.c

Git is displaying r before the file name to indicate that the file has been renamed.

For the commit operation, Jerry uses the-a flag, which allows git to submit automatic detection of modified files.

[[email protected] src]$ git commit-a-M ' Added Makefile and renamed STRINGS.C to STRING_OPERATIONS.C '

[Master 94f7b26] Added Makefile and renamed STRINGS.C to string_operations.c 1 files changed, 0 insertions (+), 0 deletions (-) Create mode 1 00644 src/makefile Rename src/{string.c = string_operations.c} (100%)

After committing, he pushed his changes to the repository.

[[email protected] src]$ git push origin master

The above command produces the following results.

Counting Objects:6, done. Compressing objects:100% (3/3), done. Writing objects:100% (4/4), 396 bytes, done. Total 4 (delta 0), reused 0 (Delta 0) to [email protected]:p roject.git 7d9ea97. 94f7b26 master−> Master

Now, other developers can update these modifications in their local repository.

PS: If you want to communicate with the industry technology Daniel, please add QQ Group (521249302) or pay attention to the public number (askharries), thank you!

Git Rename operation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.