Java面试通关秘籍- Java_Useful_8股文_Guide Those who see are destined to be destined to be destined to be destined to be destined to be destined to be destined to be destined to be destined to be destined to be destined to be destined to be destined to be destined to be destined to be destined to be destined to be destined to be destined to be destined to be destin Welcome to our Bagua website JavaU8G ——— Java_Useful_8股_Guide ???
This project
Java_Useful_8股文_Guideis committed to creating a comprehensive and practicalJava技术与面试指南, covering a wide range of fields fromJavabasics to advanced practical applications, including but not limited toJava面试,算法,JavaSE,并发编程,JVM优化,MySQL,OS,中间件,微服务and other core knowledge points, as well asSpring全家桶and设计模式.
Our knowledge base website has a unique integration of music player functions , allowing learners to focus on and master a Java knowledge point within the time of a song . This innovative learning model aims to improve learning efficiency and fun, allowing you to deeply understand the key concepts of the Java technology stack in a relaxed melody. Start an efficient journey of "
听歌学Java".While reading the detailed content of **
Java_Useful_8股文_Guide, it combines theoretical knowledge with practice to achieve a comprehensive and multi-sensory learning experience. Whether you are reviewing the basics of Java or studying the complex details of JVM tuning, there are corresponding selected songs to accompany your learning path. Developers are welcome to actively participate and personally participate in this novel learning method to jointly create more vivid and practicalJava面试and技术提升resources!
JavaSE : Explain the basic concepts and advanced features of the Java language in an easy-to-understand manner.JUC : Includes a large number of concurrent instance codes and analysis to help you master multi-threaded development skills.JVM : Provides detailed introduction to JVM principles and practical tuning cases to help you become a JVM tuning expert.DesignPatterns : Summarize common design patterns and application scenarios to improve your software design capabilities.SpringFrames : Comprehensive interpretation of the components of Spring family and their actual combat usage to enhance your competitiveness in enterprise-level development.JavaInterview : Summary of the analysis and discussion of various Java interview questions to protect you from the interview. Gitee (fast speed)Github (optional collection) In order to continuously provide high-quality content, this project will insist on regular updates daily or weekly to keep up with the latest Java technology and interview trends in a timely manner. We sincerely invite community members to participate in the contribution and share your knowledge and experience through Pull Request (PR).
Developers are welcome to follow this project, like Star to show their support, and actively participate in discussions and co-construction. Let us work together to create a high-quality and continuously updated knowledge book for the Java developer community!
How to participate? Click the Star button in the upper right corner to follow the project progress. Copy the project to your GitHub account through Fork function, modify the content and initiate Pull Request . Ask questions, suggestions or share new interview questions and analysis in Issues area.
Select a folder on the local computer and clone the repository contents into the folder
# 本处使用 ssh 协议,如未配置,需要先配置本地密钥到GitHub
# 参考链接:https://blog.csdn.net/W_317/article/details/106518894
$ git clone [email protected]:WL2O2O/JavaU8G.gitPost or update article
SUMMARY.md file in the src folder and add an index record to the corresponding location;README.md file in the src folder and add the TimeLine record to the corresponding location.Local repository tracking files
$ git add . Submit code to local repository
$ git commit -m "你的提交信息" Push code to remote GitHub collaborative repository
$ git push origin master Wait for CI / CD to be automatically updated, about three minutes
The root directory of this warehouse provides a script with one-click pull and one-click upload. Because multi-person collaboration is convenient and does not set up a multi-branch structure for management, in order to prevent forgetting to pull the latest code of the remote warehouse, you can use the script file for click-through operations.
Steps to use:
autoPull.batautoUpload.bat Q: Why did my code submitting rejection appear?
A: Because it is a multi-person cooperative repository, the local version may be inconsistent when you upload it. In order to avoid conflicts, this step 1. 更改已有的文件内容或者新增文件, you need to add the steps拉取仓库最新内容. In order to facilitate this operation, you can directly double-click the autoPull.bat script file for one-click pull, or command:
# 命令解释:拉取 master 分支最新内容 origin:分支标记,master:分支名
$ git pull origin masterAs long as you write on your resume, you will generally ask how to resolve git conflicts. Let me talk about the solution below?
Analysis of the causes of conflict:
A cooperates with B at the same time, A updates the file Test.md , and then B also updates the file Test.md locally. At this time, A does not know that it was rejected when performing push operations. Note: New files will not cause conflicts unless they are duplicated, so conflicts are generally caused by updates.
Solutions to resolve conflicts:
git checkout fileName.md Cancel the changes to a conflicting file --> git pull origin master pulls the latest content --> Updates the file again --> Push updatesHow to roll back the code:
The life cycle of general files: content modification --> commit to local branch --> push to remote warehouse
For rollbacks of modified but not committed files: you can use git checkout fileName.md to cancel changes to files
For rollbacks of modified, committed or push files:
# 查看 git 日志的提交记录的32位 hash 值
$ git log
# 回退提交,以 hash 值为 1234 为例(正常是32位)
$ git revert 1234 或者 git reset --hard 1234
revert 会保留更改文件的历史记录,创建一条新的记录,reset 是强制回退,彻底的回到指定的版本,reset 有三种模式可以选择:soft、mixed(默认)、hard(常用)
--soft模式会重置指针,但不会修改工作目录或索引。这意味着之前的更改仍
然存在于工作区中,并且可以重新提交。
--mixed模式是默认模式,它重置指针并更新索引以匹配指定的提交。这将取消索引中的所有更改,但工作目录中的更改将保留。
--hard模式会重置指针,索引和工作区。这意味着所有更改都将永久删除,并
且没有办法澈销或恢复这些更改。Github submission information, how to operateIf you have pushed the changes to the remote repository and want to modify the commit information, you can use the git rebase command to interactively modify the historical commit. Here are the general steps:
Caution: Modifying a commit that has been pushed to a remote repository is a sensitive operation. If you are working with someone else, or your repository is public, modifying historical submissions may cause trouble for others. Make sure you understand the potential risks and inform others who work with you.
Make sure your workspace is clean: Before you start, make sure your workspace has no uncommitted changes. You can use git status to check. If there are uncommitted changes, commit or save them temporarily.
Execute interactive rebase:
git rebase -i HEAD~n Here n is the number of commits you want to modify. For example, if you want to modify the most recent 3 commits, you can use git rebase -i HEAD~3
git push origin $your -branch-name$ -fReplace your-branch-name with the branch name you are working on.
Note: Forced push will overwrite the remote repository's history, so make sure you understand the consequences of this operation and notify others who work with you.
GitHub , but the submission was staggered. What should I do? 1. It's very simple. If you don't care about Github 's commit record, then you can directly modify it and submit it again. 2. You don’t want the remote commit to display multiple submission records, so you can: take the following steps to delete the code that is locally submitted and re-pushed: (The remote will delete the submission simultaneously)
git reset --soft HEAD~1This command will roll back your HEAD pointer to the last commit, but retains the workspace modifications. That is, you revoked this commit, but the modified code remains in your local repository.
git add command, and then resubmit using the git commit command: git add < modified_files >
git commit -m " Fixed issues and re-committed " Here <modified_files> is the file path or file name you modified. The -m option is followed by the submission information, you can fill it in according to the actual situation.
git push origin < branch_name > Here <branch_name> is the branch name you are currently in, such as main or develop .
In this way, you successfully deleted the wrong commit and resubmitted the modified code. Make sure that you have backed up important files and data before performing these operations.
commit records of GitHub , what should I do? If you want to show only one commit on GitHub, you can use the git rebase command to merge multiple commits into one commit. Here are one simple step:
git rebase -i HEAD~ < number_of_commits > Here <number_of_commits> is the number of commits you want to merge. For example, if you want to merge the most recent 3 commits, you can enter HEAD~3 .
pick before the commit that needs to be retained squash or s . Keep the commits you want to merge and merge the other commits into one of them.git push origin < branch_name > --force Here <branch_name> is the branch name you are currently in, such as main or develop .
Through the above steps, you can merge multiple commits into one commit, showing only one commit record on GitHub. Make sure that you have backed up important files and data before performing these operations.
References:
git command visual learning
Git Common Command Summary