Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

150
Views
Remove commits from a branch in Git

I would like to know how I can remove or roll back to (X) commit in git.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can use two ways:

  • git reset --hard HEAD~1: I WILL REMOVE THE CHANGES IN THE WORKING DIRECTORY

  • git reset --hard <sha1-commit-id>: you can git log and find a history of the commits you've made and you can go back to whatever commit you want.

For example:

 git log output: commit 5ca1232c2aad5075216df6656dfa47c297dd3438 (HEAD -> main, origin/main, origin/main, origin/HEAD, main) Author: yourUserName <yourUserEmail> Date: Tue Feb 1 19:35:33 2022 -0500 this is my commit

Once you have the commit which in our example would be " 5ca1232c2aad5075216df6656dfa47c297dd3438 " you can do git reset --hard <5ca1232c2aad5075216df6656dfa47c297dd3438>

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!