CodeX
Published in

CodeX

The essential Git Bash to GitHub workflow to get you productive fast!

Git Bash may appear to be a veritable beast to tame. Luckily, you don’t need much to start being productive and implementing an effective workflow.

The PCP Workflow overview

When you work with version control repositories, you must acknowledge that there is a server loaded with information that may be vital to your project. That goes without saying that in the situation that you are working as part of a team, there will be multiple people submitting changes to the same server.

How do you avoid merging conflicts and other conflicts with the server? It is extremely important to be mindful of the order in which you process commands when using Git Bash-Github version control.

PCP is an acromion I personally use to remember the effective and fool-proof way to version control my projects. PCP stands for Pull, Commit, and Push, we will be exploring what each means and how to execute them.

PCP workflow steps-by-step:

  1. Pull Downloads the information present in our GitHub repository giving us the most up-to-date version possible, and merges it with your current work.

Command:

$ git pull

When using git pull, you must specify the source from which you are pulling your information and the receptor.

Example:

$ git pull origin master

Note: If you need more information on setting up a connection between Git Bash and GitHub, please visit the following link: How to connect Github to Unity — A quick and easy guide!

Remember. You can always check which changes are currently available for with git status. It will show you all unsaved changes in red.

$ git status

2. Add all the unsaved changes you wish to back up in your repository with the following command.

$ git add .

git status will show you all the added files in green.

You can also add individual files by using the name of the specific file instead of “ . ” which stands for “all”.

3. Commit your added changes via commit -m, which allows you to attach a message to briefly detail what you’ve added.

$ commit -m "Added a laser to my game"

4. Push the committed changes to the server via

$ git push origin master

Summary: The essential workflow goes as follows

  1. You are pulling information from the server to make sure you have the most up-to-date version of the project, and not cause any conflicts.
  2. You are adding your current changes with the data you pulled from the server.
  3. You are committing that these are the changes you want to store
  4. Lastly, you are pushing the new content to the server.

In my next article, I will be showing you how to make your Unity Editor more productive!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Dennisse Pagán Dávila

Dennisse Pagán Dávila

An ambitious narrative designer seeking to learn more about game development and software engineering. In this documentation hub, I share my skills and learning