Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I load a specific git commit?

Tags:

git

I cloned a repository and want to switch between to a commit to test my plugin against the core.

like image 443
xZise Avatar asked Mar 07 '11 19:03

xZise


People also ask

How do I reload a previous commit?

Go back to the selected commit on your local environment Use git checkout & the ID (in the same way you would checkout a branch) to go back: $ git checkout <commit-id> .

How do I view a specific repository in a commit?

Navigate to the Code tab and make sure master is selected. (If you want to view the state of a repo for a commit on a different branch, use this Branch:master dropwdown button to change to desired branch.) Now scroll all the way down to the original commit.


2 Answers

Instead of passing the name of a branch, you can pass any commit ID to checkout:

git checkout <commit-id> 

See the man page.

like image 79
Felix Kling Avatar answered Sep 17 '22 23:09

Felix Kling


Step 1: fetch list of commits:

git log 

You'll get list like in this example:

[Comp:Folder User$ git log commit 54b11d42e12dc6e9f070a8b5095a4492216d5320 Author: author <[email protected]> Date:   Fri Jul 8 23:42:22 2016 +0300  This is last commit message  commit fd6cb176297acca4dbc69d15d6b7f78a2463482f Author: author <[email protected]> Date:   Fri Jun 24 20:20:24 2016 +0300  This is previous commit message  commit ab0de062136da650ffc27cfb57febac8efb84b8d Author: author <[email protected]> Date:   Thu Jun 23 00:41:55 2016 +0300  This is previous previous commit message ... 

Step 2: copy needed commit hash and paste it for checkout:

git checkout fd6cb176297acca4dbc69d15d6b7f78a2463482f 

Thats all.

like image 43
Igor Avatar answered Sep 21 '22 23:09

Igor