In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you GIT back to a certain commit method, I hope you will learn a lot after reading this article, let's discuss it together!
Preface
At work, Git is used more and more frequently. In addition to the most commonly used commands such as clone,add,commit,push,pull, there is also the fallback command reset. This blog post will record the simple use of the fallback command.
Scene
Because in the process of development, the company uses Aliyun's message queue MQ to process orders, time-limited purchases and other business. Or the interaction between the two systems, synchronizing information, such as the user places an order in payment system A (payment is successful), at this time payment system A not only processes the order, but also sends a message to inventory system B. tell inventory system B to reduce the inventory of goods that place orders.
When I run a project locally, if I don't comment out the listener, the message on the test suit may also be sent to me locally, resulting in the loss of the message.
Then I commented out the code of the local listener to make it easier for testers to test on the test suit. Comment out the code as shown below:
Haha ~ ~ after commenting out, I submitted it together when I submitted it! How embarrassing! The tester said bug!
A look at the code submission history ~ ~ the message listener was commented out by me. I'll carry this pot! (laughing and crying)
Solve the problem
Oops. What is said above does not seem to be quite right with what this article is going to say.
In fact, in development, I accidentally submitted the code that should not be submitted to the local, such as TaskListener, this class, changed, can not be submitted, accidentally was commit to the local (not yet pushed to the remote).
It is possible that you have commit many times to the local area.
1. First check the commit log and execute the following command
Git log
two。 Rollback, cancel previous submission
Here we assume that we should roll back to the 239afed0857cc2e77c17c01014077808619af64d version and cancel this version and subsequent commit.
Git reset-- hard commit_id / / back to / forward to the ha code commit_id:239afed0857cc2e77c17c01014077808619af64d of the specified commit
3.ok, you can resubmit.
Git commit a.txt-m "resubmit" / / remember not to submit documents you don't want to submit
IDEA RESET
You can also directly use the Reset Head feature of IDEA to get the commit_id to be rolled back through git log, and then take the screenshot below. You can validate first to see if you can find this submission through commit_id.
In the process of development, some files that cannot be submitted will always be submitted accidentally. If you use IDEA for development, you can take a look at this feature of IDEA-practical, and you don't have to worry about submission errors anymore.
After reading this article, I believe you have a certain understanding of the method of returning GIT to a certain commit. If you want to know more about it, welcome to follow the industry information channel. Thank you for your reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.