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