Git/Github to handle a project
Problems you may have encountered while working on a project?
Let’s take an example you and your colleagues are working on a project “ABC”. You and your colleagues work on a different part of the project and complete a task. Now it’s time to integrate the work you have done. After merging the code you find that the code is a mess. So, their main issue was to get back to their stable version of the project.
So, what is the solution?
Answer – Git/Github
What is git?
Git is a distributed version control system(VCS), used to manage projects. Git is essentially a local
To get started, you need to download it to your machine. Head over to https://git-scm.com/ and download and install the version most compatible with your system.
sudo apt-get install git
After installing git you need to configure it to track who did this work.
On your terminal, you need to type the following command.
– git config user. name “your name”
– git config user.email “your GitHub email”
Once installed, open a terminal and go to a project directory
Initialize a git repository
Initialization is done so that git can track the changes in your project. To initialize the project directory as a git repository you need to initialize the directory by typing following command in the directory terminal.
It will create a hidden directory in your project named **.git** which will contain all information required to track the changes and also the history of the file.
After initialization, you start working inside the directory creating files, folders. After making a change in files and reaching a certain point like a milestone, writing a function, and anything that completes your task. You can see git has found some changes in the directory by typing the following command.
Status of the repository
After typing the above command you will see something as below in your terminal. Which contains much information. It shows a list of untracked files which is needed to be tracked by the need. To let git track the file you need to add and commit the file to the git.
To add the file to git.
So to let the git track the file you need to add the file. To add the file you need to type the following command.
git add filename
which adds the file in the staging area. (To add multiple files, replace the filename with a period (.)).
Now again let’s look into the status by typing the above status command.
After typing the above command you will see a change like below and which says that the file is ready to be committed. So now let’s commit.
Commit a file.
Committing a file means creating a snapshot of your project with a message. This helps you to revisit the snapshot and know what you have done and why you have done it. To commit the changes you need to run the following command.
git commit -m “Message about the code changes”
The -m flag represents the message.
So lets again view the status of our code. Using the same old status command.
Now you will see something like this.
This means you have successfully saved the snapshot of your project up to this point. This also means you have successfully completed a simple change, add, commit workflow of git.
- Wireframing is a process of putting your design thoughts to design, draw, sketch or determine a basic layout of a …Read More
- PayPal is an electronic commerce company that facilitates payments between parties through online transfers. PayPal allows customers to establish an …Read More
- Code based testing is a way to check whether each and every line of code has been executed. The deal …Read More