Delete operation in Git
Tom updates the local repository and finds the compiled binary in the src directory. After observing the commit message, he realizes that this code is added by Jerry.
[tom @ CentOS src] $ pwd
/ home / tom / project / src
[tom @ CentOS src] $ ls
Makefile string_operations string_operations.c
[tom @ CentOS src] $ file string_operations
string_operations: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses
shared libs), for GNU / Linux 2.6.18, not stripped
[tom @ CentOS src] $ git log
commit 29af9d45947dc044e33d69b9141d8d2dad37cc62
Author: Jerry Mouse
Date: Wed Sep 11 10:16:25 2013 +0530
Added compiled binary
VCS is only used to hold source code and does not represent binary code. So, Tom decided to remove these files from within the repository. For further operations, he uses the command git rm.
[tom @ CentOS src] $ ls
Makefile string_operations string_operations.c
[tom @ CentOS src] $ git rm string_operations
rm 'src / string_operations'
[tom @ CentOS src] $ git commit -a -m "Removed executable binary"
[master 5776472] Removed executable binary
1 files changed, 0 insertions (+), 0 deletions (-)
delete mode 100755 src / string_operations
After committing, he pushes the changes to the repository.
[tom @ CentOS src] $ git push origin master
The above command will produce the following result:
Counting objects: 5, done.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 310 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
To gituser@git.server.com: project.git
29af9d4.5776472 master -> master
According to Tutorialspoint
Previous article: Operating Rename in Git
Next article: Fix bug in Git
4 ★ | 1 Vote
You should read it
May be interested
- How to delete Chrome browsing history on iPhone and iPadclearing google chrome cache on iphone is a simple operation but helps you solve some browser problems and improve your browsing experience.
- Fix Illegal Operation error on computerwhen the computer operating system or processor receives a command from a program that it does not recognize and cannot process, a command called illegal operation will appear.
- Delete the most 'stubborn' files on Windowsdelete stubborn files, delete files that cannot be erased to free up memory, and prevent computer trash. but how to delete these stubborn files? please read our instructions below.
- How to delete the arrow on the Shortcut icon in Window 10when we create the icon for the application to the desktop, we will see the difference is that there is an arrow in the left corner of the icon. although the arrow next to the icon does not affect the operation, but people often want to delete them.
- Learn the structure and principles of operation of the refrigeratorit is a familiar device for every family but the structure and principles of the refrigerator are not well understood.
- Structure & Principle of operation of air conditioner, air conditionerjoin tipsmake.com to learn about the structure and operation principles of air conditioning and air conditioning - familiar devices that help us overcome the hot summer days.
- Reg delete command in Windowsthe reg delete command helps delete subkeys or entries in the registry
- How to permanently delete a Facebook account on a computerremoving a permanent facebook account is to make you completely disappear on this social network, friends cannot find you, you cannot access the deleted facebook nick.
- How to permanently delete Tik Tok account on the phonetik tok seems to be at a record level with more than 2 billion downloads. if for some personal reasons you want to delete tik tok, follow these instructions to permanently delete tik tok account on iphone or android device.
- How to mass delete tweets posted on Twitterthere is a way for you to delete tweets without having to watch and choose to delete each tweet. here are the steps for you.