command line

clone

Now “clone” (make a copy of) your version of the repo (the fork) to your own computer. You can do that in different ways. With the command line it would be

git clone https://github.com/<MyAccount>/carob.git

Where you need to replace <MyAccount> with your github account name. You only need to do this once. The other commands below are needed every time you make changes.

pull

Before you make any changes you want to keep, you should check that your remote repo (your forked version on github) is not behind the main repo (carob-data/carob). If so, you should synchronize your github hosted clone with the main repo. Now you can “pull” the latest version to your local repo.

git pull

If you do not do this, you may create “conflicts” in which you make a change to a file that has already been edited by someone else. Conflicts can be resolved but it is best to avoid them.

branch

Create a new branch from main for each dataset you work on so that every pull request contains only one script (multiple scripts covering multiple datasets in one PR are not allowed) and you can open several PRs in parallel:

git checkout main
git pull
git checkout -b doi_10.7910_DVN_XXXXXX

When you are ready to work on another dataset, switch back to main and create a new branch for it. See Git branches for details.

status

Once you start working with the files of your fork of the repo, on your local computer, you can check which files exist in the folder but are not part of the repo (if any) and which files have changed with

git status

It is important to always run this command before using git add or git commit.

add

If you added a new file that you want to formally add to your fork of the repo, you need to run

git add <scripts/agronomy/new_file.R>

where <scripts/agronomy/new_file.R> should be the actual filename.

commit

Changes made to a file (including to a new file) need to be “committed” to the repo. You need to provide a short message describing the commit. For example “adding new file”, or “fixed georeferencing error”.

git commit <scripts/agronomy/new_file.R> -m "a short message"

push

To upload your committed branch to your fork on github, run:

git push -u origin doi_10.7910_DVN_XXXXXX

After the first push of a branch, subsequent updates on that same branch only need git push.