DEV Community

Wickliff Odoyo
Wickliff Odoyo

Posted on

BEGINNER'S GUIDE TO GIT: PUSH, PULL AND TRACKING CHANGES

Git

It is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.It is installed in the browswer by writting git and clicking the the sighn im account.

GitHub

A web based platform for developers to store,manage,and share code.

Gitbash

It is a command-line interface (CLI)tool for windows that provides an emulation layer for a unix-like environment.

Version Control(git)

Solves a mistake by keeping one single file but recording every single change you ever made.

1. Tracking Changes

In git, you don't just hit Save(ctrl + s). Tracking changes happens in three steps:

a).Modify:

You change your code.
In my case am going to create a (New text document file) to track my changes in the repository and local host,while al write a statement to confirm the changes.Then track the changes also in the github resository created.(which in my case the reporitory will be learning).WHERE WE INITIALISE GIT FIRST ( USING COMMIT INIT).Then as for me I created a repository (Learning) in the github hence I can add my new folder and track changes.

b).Stage (git add):

You "mark" which changes you want to save.
We stage our commandline by using the gitbash to add the file to the github by using command (git add).So that we can add it in the reporitory in the github and track the changes if made in the local disc or github repository.

c).Commit (git commit):

You officially save the changes with a message describing what you did (e.g.,"fixed the login button")
We use the command line (git commit -m"first commit") to make changes in the repository in github.

2.What is "Pulling"?

It is like downloading updates.
if your working on a team ,your teammates might have added new code to the shared project. To make sure you have the latest version on your computer, you pull the code.

-Command:

git pull

-Analogy

Checking your email to see if anyone sent you new documents.where you use (git fetch and git merge to pull changes from repository)

3.What is "pushing"?

It is the opposite of pulling. It is basically uploading your work to a git repository. After you have committed changes locally on your computer, no one else can see them yet. To share your work with the team (or save it to a site like GitHub),you push your commits.

-Command:

git push

-Anatomy:

Sending an email with your updated document so others can see it.

The Workflow in 4 steps

to master git as a beginner, just remember this cycle:

1. Pull:

get the latest updates from your team.

2. Work:

Write your amazing code.

3.Commit:

Record your changes locally with a descriptive note.

4.Push:Send your changes up to the cloud for everyone else.

Top comments (0)