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 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
Update 25 May 2019
You should read it
- Online Repository in Git
- Operating Rename 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
5 Examples That Prove AI Content Checkers Are Useless 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