-3

I am trying to view a list of commits that were made on a particular branch, let's call this branch "fb-1", without the quotes.

After I view the list of commits, I want to revert back to before a particular commit.

Any suggestions? I have not done this before, so wanted to ask for advice/suggestions.

  • 2
    Read the docs about [git-revert - Revert some existing commits](https://git-scm.com/docs/git-revert) – Luuk Dec 29 '22 at 15:39
  • 1
    this site is very helpful: https://sethrobertson.github.io/GitFixUm/fixup.html – topsail Dec 29 '22 at 15:41
  • 2
    Be careful: there's a difference between revert and reset. These are technical terms. – matt Dec 29 '22 at 16:04
  • 1
    Does this answer your question? [How do I undo the most recent local commits in Git?](https://stackoverflow.com/questions/927358/how-do-i-undo-the-most-recent-local-commits-in-git) – Inigo Dec 30 '22 at 00:48

2 Answers2

1

You can do it simply straight:

  1. List all of the commits git log

  2. Revert to specific commit git revert [some id of your commit on that branch]

You can see the details by clicking here.

Aatif Khan
  • 49
  • 5
0

Figured it out.

Use git log to get a list of all commits.

You can use git revert --no-commit a..b to revert all the commits starting at the commit after a (note that!) and ending at, and including, commit b. The reversion will be staged for you to commit.

  • 1
    Okay, but I mean is this really a useful contribution to Stack Overflow? It's really no different from, say, https://stackoverflow.com/a/43081965/341994 for example. What's the point of creating a duplicate of an existing and massively popular QA? – matt Dec 29 '22 at 23:49