Collaboration

A good way of learning git is to participating in an open-source project.

There are a lot of them. A good database of projects is github explore.

Let’s start with this one: https://github.com/anishathalye/neural-style.

Getting the repository

There are a few ways you can download a repository (a project).

Direct download

In the top-right corner is a green button called Clone or download: Clone or download image Click on it, then click Download zip button. Your browser will download an archive. You have to unzip it and there is your project.

Cloning the repository

This is the prefered way of downloading a repository. Press on the Clone or download button, then copy that link (https://github.com/anishathalye/neural-style.git). Write in the command prompt:

git clone https://github.com/anishathalye/neural-style.git
cd neural-style
git log

You will see a list of commits.

commit b7461815c8fee73199709273c76daf69982db3ec
Author: Anish Athalye <me@anishathalye.com>
Date:   Mon Jul 31 07:52:07 2017 -0700

    Add link to TensorFire

commit 6bb540dc89a6f0f87cfa24a951ac22db0cfeea65
Author: Anish Athalye <me@anishathalye.com>
Date:   Sat Apr 15 09:16:28 2017 -0400

    Add warning about using wrong VGG19 data

commit 6d12267b32f7913b15142f79caba6ef1bbaa56e6
Author: Anish Athalye <me@anishathalye.com>
Date:   Sat Apr 8 17:50:30 2017 -0400

    Update README

commit b9b4d693efadbbe40214e71192c89182d56c76b0
Merge: 6f86bf9 9103e94
...

A commit has:

  • a hash id (b7461815c8fee73199709273c76daf69982db3ec)
  • an author, which has a name and an email address (Anish Athalye <me@anishathalye.com>)
  • a timestamp which is a date (Mon Jul 31 07:52:07 2017 -0700)
  • a commit message, stating the changes (Add link to TensorFire)

Remember that you can record your own changes:

  • edit a file
  • write git add . in the command prompt (you must be at the root of your project); we write . instead of a file name (as hello.txt) because we want to consider all modified files
  • git commit -m "my commit message"
  • git log

Now, you can see that the change is shown as being logged. Probably you will want to change the name and the email address.