Install the Git version control system (VCS) from https://git-scm.com/downloads.
-
Go to https://github.com/new
-
Set test as the name of the repository
-
Check the checkbox Initialize this repository with a README
-
Click on create repository
-
Open up a terminal (Git bash on Windows).
-
Navigate to the designated target directory (it is typical to use the
git
folder within the home directory for storing Git repositories, e.g.,cd /home/username/git
). -
Using a Git client, clone this newly created test repository to your computer. First, get the repository URL (use HTTPS for now).
Then, issuegit clone https://url/of/the/repository.git
You should get an output similar to this:
-
Verify the contents of the working copy of the repository by
ls -la ./test
. The .git folder holds version information and history for the repository, while the README.md is an auto-generated text file by GitHub.
-
Open up a terminal and configure username and email address. These are needed to identify the author of the different changes.
Glossary — Part 1:-
Git is your version control software
-
GitHub hosts your repositories
-
A repository is a collection of files and their history
-
A commit is a saved state of the repository
-
-
Enter the working directory, then check the history by issuing
git log
. Example output:
-
Adding and commiting a file: use the
git add
andgit commit
commands.
The effect of these commands are explained on the figure below:
Glossary — Part 2:-
Working Directory: files being worked on right now
-
Staging area: files ready to be committed
-
Repository: A collection of commits
-
-
Staging and unstaging files: use
git add
to add andgit reset
to remove files from the staging area.
CautionOnly staged files will be included in the next commit. -
To display detailed changes in unstaged files use
git diff
, while usegit diff --staged
to show changes within files staged for commit.
-
The commands
git pull
(or thegit fetch
+git rebase
combination) andgit push
are used to synchronize local and remote repositories.
The source for most of the images in the Git documentation: https://github.com/shabbir-hussain/ecse321tutorials/blob/master/01-githubTutorial1.pptx