Skip to main content

How to checkout a commit in project history

Change the directory to the Ursa directory in your file system:

cd <PATH-TO-URSA-CLI-PROJECT-SOURCE>

Pull the latest commits from main by:

git fetch origin main

💡 A git fetch gathers commits from the target branch that do not exist and stores them in your local repository. It doesn't merge them with your current branch for that use git pull.

git pull origin main

Once you have the latest target branch commits, checkout to any particular commit

git checkout <Commit hash>

A git commit hash is a SHA1 hash of the state of the git repository at the time of the commit. Here's an example:

a7cfd35647ba4a3c7563a784870b8a806298bbc1

If you open the Github repository UI, you'll find the commit hash on the right-hand side of the list, check the example here.

You can run the git log command on your local repository directory to find commit hashes.

git log --oneline

Here's an example of how that'd look like:

a7cfd35 (HEAD -> main, origin/main, origin/HEAD) feat: refined bootstrapping for testplan (#282)
bec6ee7 chore: revert debug trait (#281)
06b0d77 chore(service_tests.rs): remove redundant `mod tests` (#279)
850a15c Update pull_request_template.md (#280)
5ccf7d0 feat: advertise file size (#221)
4c6e505 feat: filter peers using cache summary for getbitswap (#274)
957ed5c feat: Use graphsync to pull data (#224)
3e1b41b chore: gateway doc (#269)
99edbb7 feat: send cache summary using request response (#268)
1c6464c feat: testplan data transfer (#267)
9e979ec feat: pull request + issue templates (#265)

Let's say that you are interested in checking out the commit feat: Use graphsync to pull data.

git checkout 957ed5c

💡 We can use the first few characters of the commit hash, valid as a short version that refers to 957ed5c92b5a9570cdadc821c571b19698aaf4db.

If interested in learning more about Git visit the offical documentation reference here.