AppyPrinciplesGetting started
git's cheat sheet Clone an app or ext

The objective here is to get, on some local machine or server, a local git repository as a copy of some distant git repository.

This is known as cloning a repo.

A git repository may contain several branches, each one representing some variant of the main branch, being the base into which, in the end, any branch will need to be merged.

Cloning the main branch from a distant git repository

A first objective is to clone the main branch from a distant repo. The precise command for cloning it may depend on the repo's URL as well as on the name of the main branch as defined in this repo.

Suppose you have developed an app called Sessions. You have pushed it in a distant repo at some repoURL.

Suppose, on some target machine, you want to clone it in a folder named /home/appy/projects/Sessions.

Start by moving into the base folder.

cd /home/appy/projects

If the repo's main branch is named master, and the repoURL precisely ends with the name of your app or ext (ie, ssh://your-self@www.yourdomain.com:1568/~/Sessions), you can clone the repo by typing:

git clone repoUrl 

A folder Sessions will be added inside /home/appy/projects.

If you want to achieve the same result, but the repoURL does not precisely end with the app or ext name (ie, ssh://your-self@www.yourdomain.com:1568/~/SessionsV2), you can clone the repo by typing:

git clone repoUrl Sessions 

The same result will be achieved, but you had to specify the name of the target folder explicitly.

The previous examples work well if the main repo branch is named master. It the main branch has another name (ie, main), you'll have to set it explicitly via attribute --branch, like in the following examples.

git clone repoUrl --branch main

or

git clone repoUrl Sessions --branch main

Keep you clone in sync with the repo

Once cloning has occurred as explained in the previous section, getting, in the clone, the last updates from the distant repo is done via the git pull command. Here is an example.

cd /home/appy/projects/Sessions
git pull