Exercise 3
Exercise 3
Configure the web application and Version control using Git using Git commands and version
control operations.
What is GIT?
Git is a free open-source distributed version control system you can use to track changes in
your files. You can work on all types of projects in Git, from small to large.
With Git, you can add changes to your code and then commit them (or save them) when
you're ready. This means you can also go back to changes you made before.
What is GitHub?
GitHub is a web interface where you store your Git repositories and track and manage your
changes effectively. It gives access to the code to various developers working on the same
project. You can make your own changes to a project at the same time as other developers are
making theirs.
If you accidentally mess up some code in your project while making changes, you can easily
go back to the previous stage where the mess has not occurred yet.
To start using Git, you'll need to download it to your computer if you haven't already.
You can do this by going to their official website.
When Git opens, scroll down a bit and you should see a download button. Go ahead
and click on it.
Download button on the Git website
Choose your operating system whether it's Windows, MacOS, Linux/Unix. In my
case, I will be choosing the Windows option because I am using a Windows computer.
Choose your operating see your system
Click on the first link at the very top of the page to download the latest version of Git.
Download the latest version of Git by clicking the first link
When the download is complete, then go ahead and install Git to your computer.
You'll need to go to the location where the file has been downloaded and install it.
After the installation, you'll want to make sure that Git is successfully installed on
your system. Open your command prompt or Git bash (whichever one you choose to
use) and run the command
Now that we have installed Git on our computer, we have to configure it. We do this so that
any time we are working in a team on a project, we can easily identify the commits we have
made in the repository.
To configure Git, we need to specify the name, email address, and branch by using the git
config --global command. For example:
3. Fill out the repository name and other details (public/private), then click Create
Repository.
After creating the repository, GitHub will provide you with the repository URL, such
as:
https://github.com/username/repository-name.git
Creating a file
Open C or D drive and create a new folder with some name
In new folder, create any file (txt or word or pdf)
Steps for uploading file from local system to GitHub through Git
1. Navigate to your project folder on your local system using the terminal or command
prompt:
cd /path/to/your/project
git init
1. Copy the file to your project folder (if it’s not already there).
After adding the file(s) to the staging area, commit the changes:
Tell Git where your remote GitHub repository is by adding the remote URL:
Go to your repository on GitHub, and you should see the file(s) you uploaded listed.
Example: