Git: Pull, Commit and Push. Order Does Matter

When you are ready to start saving changes to your project, there are steps you need to do in a certain order, especially if you are working with teams.

That order is:

  1. Pull — fetch and merge and commits from the remote server(GitHub). Ex. git pull origin<remote server>master<branch>
  2. Add — Adds the changes to the next commit. Ex. git add .(the period with add all files with changes)
  3. Commit — commits the added changes to a snapshot ready to transmit. Ex. git commit -m “create enemy” (the -m adds a description to the commit)
  4. Push — transmit the local branch commits to the remote server(GitHub). Ex. git push origin<remote server> master<branch>

Following this order will help eliminate the headaches of merge conflicts.