Add files

git add

Add the specified file:

git add test.txt Test.java
Copy the code

Add all files:

git add .
Copy the code

Canceling adding a file

Git reset HEAD — filename

git reset HEAD -- Test.java
Copy the code

So test.java will not be committed to the repository.

Delete the file

Git rm – cached fileName

By default, the file is cancelled and deleted; –cached indicates that the file is not deleted.

Move/rename the file

git mv filename1 filename2
Copy the code

The file must be added to the repository to operate.

View file submission records

git log

$ git log
commit a3eb048ca74c3881f70264de90671d95474f241e (HEAD -> master, origin/master, origin/HEAD, javastack)
Author: javastack <[email protected]>
Date:   Fri Sep 22 10:38:37 2017 +0800

    commit

commit 75336d6769e79581af8aefe2a15c9b2f305064c5
Author: javastack <[email protected]>
Date:   Wed Sep 20 11:19:29 2017 +0800
Copy the code

Recommended reading

Dry goods: 2TB architect four-stage video tutorial

Interview: the most complete Java multithreaded interview questions and answers

Interview: the most comprehensive ali advanced Java interview questions in history

Interview: The most complete Spring interview questions in history

Tutorial: The most complete Spring Boot complete video tutorial

Books: 15 must-read books for advanced Java architects

Tools: Recommended an online creation flow chart, mind mapping software

Share Java dry goods, high concurrency programming, hot technology tutorials, microservices and distributed technology, architecture design, blockchain technology, artificial intelligence, big data, Java interview questions, and cutting-edge hot news.