Link Search Menu Expand Document

Working with Version Control

Table of contents

  1. Pull from Existing Repository
    1. Steps
  2. Committing and Pushing Changes
    1. Steps
  3. Side-note

Pull from Existing Repository

As you learn how to code, you soon realize that there will be a lot of group coding involved. As such, it is important to be aware of certain practices when it comes to version control. One of them happens to be “Pull first, make changes and commit later”. Therefore, we will go over how to pull first before we get to committing and pushing changes.

Steps

  1. Press the update project button.

    pulling

  2. Check off Merge incoming changes into the current branch then press ok.

    merging

    Recommended

         "Rebase the current branch on top of incoming changes" will 
         also integrate changes from one branch to another. However, rebasing
         can be dangerous because it can "rewrite history" of shared branches.
         Therefore, it is better to _Merge incoming changes_ instead.
    

Congratulations! You should see a pop-up that indicates successful project update.

success


Committing and Pushing Changes

We have all experienced losing our saved work whether by forgetting where we have put them or messing up so bad the file got corrupted. It is also important to save your work when coding as well. To do that, you need to commit the changes you have made and push the changes to the repository you have cloned.

Steps

If you see your files change colour as highlighted below, it means there are changes made that is not saved.

committing_changes

As highlighted below, you will see 3 shapes on the top right of your PyCharm.

  1. Press the Check-mark shape to commit.

    committing_changes

  2. Check the files you want to save.

    committing_changes

  3. Fill out the changes you have made to those files.

    committing_changes

    Simple descriptions that others can understand what changes you have made are best.

    CAUTION

         You may choose to press "commit" here to simply commit the changes you have made. 
         However, in order to SAVE the changes you have made to a repository that you cloned from,    
         you must also "push" the changes you made as well. The next step will entail "pushing" changes.
    
  4. Press the downward arrow next to commit button.

    committing_changes

    You will be led to a new window detailing what will be pushed.

  5. Press commit and push and then push.

    committing_changes

Congratulations! You committed and pushed the changes you made to the files!

Recommended

It is a good practice to commit and push often;   
Committing and pushing after coding a function is ideal.

Side-note

CAUTION

If you have run into this error above, it means the repository has changes that your local files have not received yet. You can press Merge here to push and update your current files. However, it is good practice to pull first before committing and pushing.

merge_conflict