Go to particular revision

I cloned a git repository of a certain project. Can I turn the files to the initial state and when I review the files go to revision 2, 3, 4 … most recent? I’d like to have an overview of how the project was evolving.

  • Git issue - out of memory, malloc failed. Need to modify repo with filter-branch or similar
  • How to view file history in Git?
  • Migrating from SVN to Git with non-standard svn layout (need full history)
  • Merge old git commit with HEAD at master
  • How can I efficiently navigate a Git repo to follow project development?
  • How to overcome git merge history ambiguity/obfuscation with '--ours'?
  • Using git, how can I create a mostly history-less clone of a repository
  • See history in GitHub after folder rename
  • 8 Solutions collect form web for “Go to particular revision”

    Use git checkout <sha1> to check out a particular commit.

    You can get a graphical view of the project history with tools like gitk. Just run:

    gitk --all

    If you want to checkout a specific branch:

    git checkout <branch name>

    For a specific commit, use the SHA1 hash instead of the branch name. (See Treeishes in the Git Community Book, which is a good read, to see other options for navigating your tree.)

    git log has a whole set of options to display detailed or summary history too.

    I don’t know of an easy way to move forward in a commit history. Projects with a linear history are probably not all that common. The idea of a “revision” like you’d have with SVN or CVS doesn’t map all that well in Git.

    To go to a particular version/commit run following commands. HASH-CODE you can get from git log --oneline -n 10

    git reset --hard HASH-CODE

    Note – After reset to particular version/commit you can run git pull --rebase, if you want to bring back all the commits which are discarded.

    I have created a command line python tool to see how a project evolved. you could see if that helps. The tool is hosted on the git at the following url


    Using a commit’s SHA1 key, you could do the following:

    • First, find the commit you want for a specific file:

      git log -n <# commits> <file-name>

      This, based on your <# commits>, will generate a list of commits for a specific file.

      TIP: if you aren’t sure what commit you are looking for, a good way to find out is using the following command: git diff <commit-SHA1>..HEAD <file-name>. This command will show the difference between the current version of a commit, and a previous version of a commit for a specific file.

      NOTE: a commit’s SHA1 key is formatted in the git log -n‘s list as:

    commit <SHA1 id>

    • Second, checkout the desired version:

      If you have found the desired commit/version you want, simply use the command: git checkout <desired-SHA1> <file-name>

      This will place the version of the file you specified in the staging area. To take it out of the staging area simply use the command: reset HEAD <file-name>

    To revert back to where the remote repository is pointed to, simply use the command: git checkout HEAD <file-name>

    One way would be to create all commits ever made to patches. checkout the initial commit and then apply the patches in order after reading.

    use git format-patch <initial revision> and then git checkout <initial revision>.
    you should get a pile of files in your director starting with four digits which are the patches.

    when you are done reading your revision just do git apply <filename> which should look like
    git apply 0001-* and count.

    But I really wonder why you wouldn’t just want to read the patches itself instead? Please post this in your comments because I’m curious.

    the git manual also gives me this:

    git show next~10:Documentation/README

    Shows the contents of the file Documentation/README as they were current in the 10th last commit of the branch next.

    you could also have a look at git blame filename which gives you a listing where each line is associated with a commit hash + author.

    I’d like to mention the command-line tool tig, available seemingly everywhere. It is a text-graphical tree-view with tag display, etc. of project revision history. It can be used over ssh, etc. Super handy.

    The best tool available to use is smartgit . You can pull and push. Its free for non commercial use. Makes life easy

    Git Baby is a git and github fan, let's start git clone.