DEV Community

Wickliff Odoyo
Wickliff Odoyo

Posted on

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

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.

b).Stage (git add):

You "mark" which changes you want to save.

c).Commit (git commit):

You officially save the changes with a message describing what you did (e.g.,"fixed the login button")

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.

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)