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:
- Pull — fetch and merge all commits from the remote server(GitHub). Ex. git pull origin<remote server>master<branch>
- Add — Adds the changes to the next commit. Ex. git add .(the period with add all files with changes)
- 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)
- 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.