Before we start writing Git, we should get acquainted with it:
- Learn some popular Git commands:
add, commit, push, pull, fetch, reset
- Get some acquaintance with Git internals. This is a popular topic, so there are plenty of videos available, like this one for example. Additionally there's a respective chapter in Git Book.
You already have learned that any Git Object is represented by its hash based ID generated by SHA-1 algorithm. You task is to implement this:
class Sha {
private final String hex;
public Sha(String hex) {
this.hex = hex;
}
public static Sha from(byte[] content) {
...
}
public String hex() {
return hex;
}
public String toString() {
return hex;
}
}
Don't forget to write unit tests.