8  Editing

8.1 When you are the only one editing at the time:

When finished with an editing session:

  1. Pull: in the terminal window, type “git pull”
    1. This merges in any changes someone else made to the repo
  2. Commit: in the terminal window, type “git commit -am
    1. This prepares your changes for uploading
  3. Push: in the terminal window, type “git push”
    1. This uploads your changes to the GitHub repository

Next time you are ready to edit: Pull, then edit as you like, then Commit and Push.

8.2 When someone else is also editing (a different part of the file):

  1. Commit: in the terminal window, type “git commit -am
    1. This protects your changes
  2. Pull: in the terminal window, type “git pull”
    1. This merges in what your friend did
  3. Push: in the terminal window, type “git push”
    1. This uploads your changes to the GitHub repository

If you try pulling without committing, you will get an error.

8.3 When someone else (unfortunately) edits the same line as you

You must resolve these differences!

  1. Pull: in the terminal window, type “git pull”
    1. You will get a “merge conflict” error message
  2. Edit your file. You will see something like this:
    <<<<<<<<<<<
    passage written by person 1
    ===========
    passage written by person 2
    >>>>>>>>>>>
  3. Remove one of the passages, as well as the <<<, ===, and >>> symbols.
  4. Commit: in the terminal window, type “git commit -am
    1. This prepares your changes for uploading
  5. Push: in the terminal window, type “git push”
    1. This uploads your changes to the GitHub repository


Depending on your IDE, there may be more convenient or visual ways of dealing with merge conflicts. It’s always good to check your IDE’s documentation or look up how to deal with merge conflicts in your specific IDE. ChatGPT can be a great resource, too!