DEV Community

Ajani luke Kariuki
Ajani luke Kariuki

Posted on

Use of Git to push/pull code, track changes and version control

Setting up Git and using it for version control involves a few key steps, including installing Git, creating a repository, making commits, and using push and pull commands to sync your work with a remote repository. Here's a detailed guide to help you get started:
Firstly

Push and pull

Push-Refers to sending your local changes(code or data) to a remote system or_ repository_(git hub)
Pull -Refers to fetching and intergrating changes from the remote system back to your local environment.

Set Up Git

  • After installing Git, you need to configure it with your usre information. Using comands like: Git config --global user.name"y/n"

git config --global user.email "your email"

Next are the linus commands.
###First we make a directory###
with this comand: mkdir project1
(project1 being the name of the directory)

Next change directory
with: cd project1

Creating repository

After jumping into the project1 or test1, initialise a repository
:git init

Making commits

Add files to the repository

Use the (git add .) command to prepare the file for commitment

Next commit
using: git commit -m "Add readme.md"

Pushing changes

To push commits to a remote repository, one must first create a repository and link it to your local repostory


##pulling changes##
To update your local repository with new chaneges from the reote repository:

Top comments (0)