top of page
dp.jpg

Hi, thanks for stopping by!

Hope you are getting benefitted out of these articles. Don't forget to subscribe to the Newsletter where we will serve you with the curated content right at your mailbox.

Let the posts
come to you.

Sponsor the Author.

Revert last pushed Git Commit

  • Apr 6, 2022
  • 2 min read

Updated: Apr 7, 2022

Many times we push some commit to GitHub which is required to be reverted due to whatever reason.

There are high chances that you might be facing this issue regarding How to undo the last commit?



You need not worry I have got you covered, there could be other ways as well, but this one I have been using for quite some time.


First, we will start by making pushing a commit to the Github repo.



We already saw that there is a commit as "first commit". Now we make some changes and commit again with the commit message "second commit".


// Make changes in any of the file
> git add .
> git commit -m "second commit"
> git push origin master

Here we can see we have a second commit with the message "second commit" pushed in Github.

Now we want to revert this commit to the first commit. First, we will check the logs using the following command.



> git logs

commit 12c2b0d3e7378c8d4e0ab916b89e729ab96ce056 (HEAD -> master, origin/master)
Author: Apoorv Tomar <apoorvtomar@Apoorvs-MacBook-Pro-M1.local>
Date:   Wed Apr 6 22:13:30 2022 +0530
    second commit

commit 78333de1b46172e05b4c3cce8991aa08e18985d2
Author: Apoorv Tomar <apoorvtomar@Apoorvs-MacBook-Pro-M1.local>
Date:   Wed Apr 6 20:50:22 2022 +0530
    first commit

    
> git reset 78333de1b46172e05b4c3cce8991aa08e18985d2
    
> git reset --hard
    
> git push -f origin master
    

By using these commands you will be able to reset any of the older commits. You can reset the code by git reset --hard as most of the files which you have committed would be unstaged. By force pushing the code using "-f" flag, we will be able to override the older second commit which we have pushed earlier.


Video Tutorial Link

A video tutorial explaining the above concept.


About The Author


Apoorv Tomar is a Software developer and part of Mindroast. You can connect with him on Twitter, Linkedin, Telegram and Instagram. Subscribe to the newsletter for the latest curated content. Don’t hesitate to say ‘Hi’ on any platform, just stating a reference of where did you find my profile.






2 Comments


Guest
5 days ago

Mình có thói quen xem soi cầu XSMB hằng ngày để nắm nhanh tình hình trước giờ quay, nhất là lúc muốn nhìn lại nhịp ra số mấy hôm gần đây. Khi cần so sánh thêm thì mình ghé qua soi cau mb ở giữa buổi, rồi đối chiếu với mấy bảng dự đoán XSMB kèm thống kê lô gan và lô xiên cho dễ hình dung xu hướng. Trong nhóm mình cũng hay bàn chuyện dữ liệu lịch sử với mấy công cụ quay thử như Rồng Bạch Kim, vì nhìn tần suất thực tế rõ ràng hơn nên đỡ đoán mò. Cá nhân mình thấy dự đoán xổ số miền Bắc không chỉ dựa vào may rủi, mà…

Like

Guest
Aug 11

Mình chơi xổ số kiểu cho đỡ chán thôi, chủ yếu xem kết quả để giải trí chứ không đặt nặng chuyện trúng to. Trước đây nghe bạn bè rỉ tai mấy kiểu “cầu” này “cầu” kia, mình cũng tò mò nên thử theo dõi một thời gian. https://soicauxsmb.io/quay-thu-xsmb.html Lúc đọc mấy bài dự đoán, mình thường ghi lại vài con số hoặc ý chính rồi chờ ra kết quả để so lại, coi như tự kiểm tra xem có phải mình chỉ nhớ những lần đúng mà quên lần sai không. Có bữa trúng chút thì vui, bữa trật hết cũng chẳng sao, miễn đừng sa đà và vẫn giữ được tiền lẫn tâm lý ổn. Nói chung thêm…

Like

Let me know what's on your mind

Thanks for submitting! Expect a response between 24-48 hours.

© 2021 Mindroast

bottom of page