Operating Rename in Git
So far, both Tom and Jerry are using manual commands to compile their projects. Now, Jerry decided to create a Makefile for the project and also put a name for the file string.c.
So far, both Tom and Jerry are using manual commands to compile their projects. Now, Jerry decided to create a Makefile for the project and also put a name for the "string.c" file.
[jerry @ CentOS project] $ pwd
/ home / jerry / jerry_repo / project
[jerry @ CentOS project] $ ls
README src
[jerry @ CentOS project] $ cd src /
[jerry @ CentOS src] $ git add Makefile
[jerry @ CentOS src] $ git mv string.c string_operations.c
[jerry @ CentOS src] $ git status -s
A Makefile
R string.c -> string_operations.c
Git is pointing R before the file name to indicate that the file has been renamed.
For commit operations, Jerry uses the -a extension, which makes git commit automatically find modified files.
[jerry @ CentOS 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 100644 src / Makefile
rename src / {string.c => string_operations.c} (100%)
After committing, he pushes his changes to the repository.
[jerry @ CentOS src] $ git push origin master
The above command will produce the following result:
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 gituser@git.server.com: project.git
7d9ea97.94f7b26 master -> master
Now, other programmers can observe changes by updating their local repository.
According to Tutorialspoint
Previous article: Online Repository in Git
Next post: Delete activity in Git
You should read it
- Delete operation in Git
- Online Repository in Git
- Clone activity in Git
- Create activity in Git
- How to Use Deploy Keys on Github
- How to Import a Repository on Github
- What is GitHub? Overview of GitHub
- Push operation in HTML
- How to Clone a Repository on Github
- Microsoft's private GitHub repository was hacked
- Snapchat source code is revealed on GitHub
- Update activity in Git
Maybe you are interested
Why You Shouldn't Trust AI to Generate Personalized Content? Detection of exoplanets with extreme climates and extremely unusual orbits The 'white whale' planet was observed for the first time by a $10 billion telescope How to Make Almond Paste Customizable English spell checker dictionary in Word 2007 How to comment, see the 2018 World Cup news right on Zalo