Wednesday 17 July 2019

Git- Part 2: Cloning a repo and making changes

Git Basics: Cloning a Repo

Command: git clone [directory]

● This command creates a FULL clone of the repo into the directory. Only needs to be done once.
● If [directory] is not specified, it will create a directory with the same base name.

[anandg anandg@ /home/anandg]$ git clone git@github:testrepo.git

Cloning into 'testrepo'...

remote: Counting objects: 8694, done.

remote: Compressing objects: 100% (3054/3054), done.

remote: Total 8694 (delta 5561), reused 8590 (delta 5482)

Receiving objects: 100% (8694/8694), 1.59 MiB | 371.00 KiB/s,

done.

Resolving deltas: 100% (5561/5561), done.

[anandg anandg@ /home/anandg]$ cd testrepo

[anandg anandg@ /home/anandg/testrepo (master)]$

 

Git Basics: Cloning a Repo

● Command: git clone [directory]

● Here[directory] was specified resulting in a customized destination directory name.

[anandg anandg@ /home/anandg]$ git clone git@github:testrepo.git foobar

Cloning into 'foobar'...

remote: Counting objects: 8694, done.

remote: Compressing objects: 100% (3054/3054), done.

remote: Total 8694 (delta 5561), reused 8590 (delta 5482)

Receiving objects: 100% (8694/8694), 1.59 MiB | 712.00 KiB/s, done.

Resolving deltas: 100% (5561/5561), done.

[anandg anandg@ /home/anandg]$ cd foobar

[anandg anandg@ /home/anandg/foobar (master)]$

 

Git Basics: Making Changes

● What do you do with a full repo? You make changes!

● How do I make changes?

1. Start editing/saving some number of files

'F' (no need to "unlock" a file)

2. Identify which files 'S' you would like to

prepare for the next commit (where S < F )

3. Commit

● The WORKING DIRECTORY is your baseline set of files which you are able to modify
● The STAGING AREA allows one to define a subset of the files to prepare for COMMITTAL

 

NOTE:

From this point forward, all subsequent GIT commands need to be run from INSIDE the locally, cloned repository

No comments:

Post a Comment