002 — Commanding Pushes

1) PULL current data ****from the server

2) COMMIT your changes

3) PUSH your updated data ****to the server

Let’s begin with pulling the initial data from the remote repo with the following command:

git pull

Resulting in the following message:

Please specify which branch you want to merge with.

Determine what branch you want to use — how do you know what branches you have? Use command:

git branch

The branch you’re in is at the end of the prompt in parentheses and light blue font. As you can see, it’s listed as “master” as the default branch. This is a setting in GitBash, but on GitHub, they use “main” as the primary branch.

To change your GitBash settings, use the following command so it’ll initiate with “main” instead of “master”, too.

git config --global init.defaultBranch main

If your current repository has a master branch, you can delete it — after making the main branch — with the following command:

git branch -m master main
  1. And now the first P — PULL! Use command
git pull origin main
  1. Now we need to get the status of our local repositories to see what all we need to commit with the following command:
git status

The items in red are items not being tracked, so they need to be added.

This can be done folder-by folder, like this:

git add Assets/

But if you need to add all of the red, use this command:

git add .

Once everything in need of backing up is added, they need to be committed to the push with the following command:

**git commit -m “[message]”**

The message is a brief description of what you just worked on and are committing to the repo.

And once everything is added and committed, it’s time to push with the following command:

**git push origin main**

Next up we’re going to go deeper into branches.

Thanks for reading, we’ll see you next time!

--

--

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
Cliff Bailey

Cliff Bailey

Software Developer w/ADHD learning and doing life.