preface
Git is an essential skill at work and plays a vital role in the development process of a project. Below introduce some Git in the work some use practice, common flow, common command, for your reference! Java Oop, Java Collections containers, Java exceptions, concurrent programming, Java reflection, Java serialization, JVM, Redis, Spring MVC, MyBatis, MySQL database, messaging middleware MQ, Dubbo, Linux, ZooKeeper, distributed & data structure and algorithm, etc. 25 thematic technical points, are all small editor in each big factory summary of the interview real questions, there have been many fans with this PDF to win many big factory offer. Today, here is a summary to share to everyone! [Finished]
The full version of the Java interview questions address: 2021 latest interview questions collection collection.
The serial number | project | content | link |
---|---|---|---|
1 | The middleware | Java Middleware (2021) | Juejin. Cn/post / 694870… |
2 | Micro service | Java Microservices (2021) | Juejin. Cn/post / 694906… |
3 | Concurrent programming | Concurrent Programming in Java (2021 latest Edition) | Juejin. Cn/post / 695053… |
4 | Java based | Java Basics (2021) | Juejin. Cn/post / 695062… |
5 | Spring Boot | Spring Boot Interview Questions (2021 Latest edition) | Juejin. Cn/post / 695137… |
6 | Redis | Redis Interview Questions (2021 Latest edition) | Juejin. Cn/post / 695166… |
7 | Spring MVC | Spring MVC (2021) | Juejin. Cn/post / 695166… |
8 | Spring Cloud | Spring Cloud Interview Questions (2021) | Juejin. Cn/post / 695245… |
9 | MySQL optimization | MySQL optimize interview questions (2021 latest edition) | Juejin. Cn/post / 695246… |
10 | JVM | JVM Performance Tuning Interview questions (2021 Latest Edition) | Juejin. Cn/post / 695246… |
11 | Linux | Linux Interview Questions (2021 latest edition) | Juejin. Cn/post / 695287… |
12 | Mybatis | Mybatis (2021 latest Edition) | Juejin. Cn/post / 695287… |
13 | Network programming | TCP, UDP, Socket, Http Network programming interview (2021 latest edition) | Juejin. Cn/post / 695287… |
14 | Design patterns | Design Mode Interview Questions (2021 Latest edition) | Juejin. Cn/post / 695544… |
15 | Big data | 100 Big Data Interview Questions (2021 latest edition) | Juejin. Cn/post / 695544… |
16 | Tomcat | Tomcat Interview Questions (2021 Latest edition) | Juejin. Cn/post / 695570… |
17 | multithreading | Multithreaded Interview Questions (2021 Latest edition) | Juejin. Cn/editor/draf… |
18 | Nginx | Nginx_BIO_NIO_AIO interview Questions (2021 Latest edition) | Juejin. Cn/editor/draf… |
19 | memcache | Memcache Interview Questions (2021 latest edition) | Juejin. Cn/post / 695608… |
20 | Java exception | Java Exception Interview Questions (2021 Latest edition) | Juejin. Cn/post / 695644… |
21 | The Java virtual machine | Java Virtual Machine Interview (2021 latest edition) | Juejin. Cn/post / 695658… |
22 | Java collection | Java Set Interview Questions (2021 Latest edition) | Juejin. Cn/post / 695684… |
23 | Git Git | Git Command (2021) | Juejin. Cn/post / 695692… |
24 | Elasticsearch | Elasticsearch (2021 Latest Edition) | Juejin. Cn/post / 695840… |
25 | Dubbo | Dubbo Interview Questions (2021 Latest edition) | Juejin. Cn/post / 695842… |
1. Configuration Operations
1. Global configuration
Git config --global user.email -- git config --global user.email -- git config --global user.email -- git config --global user.emailCopy the code
2. The current warehouse configuration
Git config --local user.email 'git config --local user.emailCopy the code
3. View the global configuration
git config --global --list
Copy the code
4. View the current warehouse configuration
git config --local --list
Copy the code
5. Delete the global configuration
Git config --unset --global Specifies the configuration item to be deletedCopy the code
6. Delete the current warehouse configuration
Git config --unset --local Specifies the configuration item to be deletedCopy the code
2. Local operation
1. View the changes
git status
Copy the code
2. Add all changes under the current directory and its subdirectories to the staging area
git add .
Copy the code
3. Add all changes in the warehouse to the temporary storage area
git add -A
Copy the code
4. Add the specified file to the staging area
Git add file 1 file 2 file 3Copy the code
5. Compare all differences between workspaces and staging areas
git diff
Copy the code
6. Compare a file workspace and staging area
Git diffCopy the code
7. Compare all differences between the staging area and HEAD
git diff --cached
Copy the code
8. Compare the difference between a file’s staging area and HEAD
Git diff --cached fileCopy the code
9. Compare a file workspace with a HEAD
Git diff HEAD fileCopy the code
Create a COMMIT
git commit
Copy the code
11. Restore the files specified in the workspace to be consistent with the staging area
Git checkout file 1 file 2 file 3Copy the code
12, restore the staging area specified file to be consistent with HEAD
Git reset file 1 File 2 File 3Copy the code
13. Restore all files in the staging area and workspace to be the same as HEAD
git reset --hard
Copy the code
14. Use DiffTool to compare any two commits
Git DiffTool Commit 1 Commit 2Copy the code
Check which files are not controlled by Git
git ls-files --others
Copy the code
16. Save unprocessed changes to stash first
git stash
Copy the code
17. Pick up where you left off when temporary tasks are finished
- Pop doesn’t keep Stash
- Apply to retain stash
git stash pop
git stash apply
Copy the code
18. Look at all stash
git stash list
Copy the code
Retrieve a stash change
Git stash pop stash@{number n}Copy the code
20. Gracefully modify the last commit
git add.
git commit --amend
Copy the code
Branch operation
1. View the current working branch and local branch
git branch -v
Copy the code
2. View the local and remote branches
git branch -av
Copy the code
3. View the remote branch
git branch -rv
Copy the code
4. Switch to the specified branch
Git checkout specifies a branchCopy the code
5. Create a new branch based on the current branch
Git branch New branchCopy the code
6. Create a branch based on the specified branch
Git branch New branch Specifies the branchCopy the code
7. Create branches based on a COMMIT
Git branch Specifies the ID of a commit in a new branchCopy the code
8. Create and switch to the branch
Git checkout -b new branchCopy the code
9. Safely delete a local branch
Git branch -d Specifies the branch to be deletedCopy the code
10. Forcibly delete a local branch
Git branch -d Specifies the branch to be deletedCopy the code
Delete all local branches that have been merged with the master branch
git branch --merged master | grep -v '^\*\| master' | xargs -n 1 git branch -d
Copy the code
12. Delete all local branches of remote Origin that no longer exist
git remote prune orign
Copy the code
13, merge branch A into current branch and create A COMMIT for merge
Git merge A branchCopy the code
Merge branch A into branch B and create A COMMIT for merge
Git merge A branch B branchCopy the code
15. Rebase the current branch based on the B branch so that the B branch can join the current branch
Git rebase B branchCopy the code
16. Rebase A branch from B to merge B into A
Git rebase B branch A branchCopy the code
4. Change history
1. Each commit of the current branch is displayed in one line
git log --oneline
Copy the code
2. Display the nearest N commits
git log -n
Copy the code
3. Show the history of all branches by graphical representation
git log --oneline --graph --all
Copy the code
4. View all commits that involve changes to a file
The git log fileCopy the code
5. Modify the corresponding commit and author for each line of a file
Git blame fileCopy the code
Five, label operation
1. View existing labels
git tag
Copy the code
2. Create a label
Git tag v1.0Copy the code
3. Create a label with remarks
Git tag-a v1.0-mCopy the code
4. Label the specified COMMIT
Git tag v1.0 commitidCopy the code
5. Push a local TAB
Git push origin v1.0Copy the code
6. Push all unpushed local tags
git push origin --tags
Copy the code
7. Delete a local label
Git tag - d v1.0Copy the code
8. Delete a remote label
Git push origin: refs/tags/v1.0Copy the code
6. Remote interaction
1. View all remote repositories
git remote -v
Copy the code
2. Add a remote repository
git remote add url
Copy the code
3. Delete the remote repository
Git remote remove remote nameCopy the code
4. Rename the remote repository
Git remote rename git remote renameCopy the code
5. Pull all branch and label changes from the remote end to the local end
git fetch remote
Copy the code
6. Pull changes from the remote branch to the local branch and merge the changes to the local branch
Git pull Origin Branch nameCopy the code
7. Push the local branch to the remote
Git push Origin branch nameCopy the code
8. Delete the remote branch
Git push remote --delete remote branch name Git push remote: remote branch nameCopy the code