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 all 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.

Pull, add, commit and push



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