How to Effectively Manage GitHub Pull and Push Issues with Other Developers

How to Effectively Manage GitHub Pull and Push Issues with Other Developers

Hi,
My name is Ebunoluwa😊. In this article, I will walk you through the process of pulling from and pushing to a GitHub repository, which is essential for collaborating with other developers and managing your projects effectively.

What is GitHub?

GitHub is a cloud-based platform on which you can store, share, and collaborate with others to write code.

What is a repository?
A repository, in layman’s terms, is a place or container where something is deposited or stored.

In tech, a Repository (shortly called repo) is a type of centrally located storage where files are stored and tracked with version control, allowing developers to collaborate on code easily. Storing your code in a "repository" on GitHub allows you to showcase, keep, manage your files, or share your work and track and manage changes to your code over time.

Explaining remote repository and local repository?

Remote Repository is the version of your project that is hosted on the Internet or network somewhere, In this case on GitHub. A local repository is hosted on a local machine( for instance, your laptop) for an individual user.

A remote repository is hosted on GitHub and accessible by anyone with permission. A local repository, on the other hand, exists only on your machine(laptop).

A step-by-step procedure for pulling from the GitHub remote repository and pushing to it.

This step works best when working with other developers because each person will be making contributions based on the task assigned to them.
So, if you were assigned a task and you want to begin:

First, pull from the master branch on GitHub to the new branch in the VS Code. This ensures your local repository is up to date before making changes. Let’s do this practically:

  1. Open the VS Code, and ensure you have the repository cloned and opened.

  2. Open the terminal in VS Code by selecting terminal from the menu or press ctrl + ` for the shortcut.

  3. Ensure you are on the right branch. Check that you are on the master branch. If not, switch to it by running the command:

     git checkout master
    
    1. Pull from Github. Use the command to pull the latest changes from the master branch.
    git pull origin master
    //This fetches and integrates the changes from the remote repository

Resolve any conflicts and merge where necessary.

  1. After that, you’ll have the latest changes in the master branch on your local repository, which will be up to date with the remote master branch.

  2. You can now continue working on the new branch in VS Code! by Creating a new branch and switching to it using the command :

git checkout -b new-branch-name
or
click on the branch indicator on the bottom-left corner, and type 
ft/new-branch-name in the search bar to create a new branch

After the pulling, what do you do when you have finished the assigned task?

git add . //do this one at a time
git commit -m "put in message"
git push

You can then proceed to the repository to create a pull request.

Mastering Git and GitHub workflows is an important tech skill, I wish I had known early. Whether you're working with a team or managing your projects, being able to pull and push code efficiently ensures that your work stays organized and up to date. It’s a fundamental aspect of working in any professional environment.

You did it!
Well done! ✨

Happy Coding!💕