Version Control

About · GitHub
What is Git? An overview of Git and why you should use it | by Jatin  Varlyani | Level Up Coding
  • Almost all “real” projects use some kind of version control
  • Essential for team projects, but also very useful for individual projects
  • Some well-known version control systems are CVS, Subversion, Mercurial, and Git.
  • We’ll use Git and GitHub!

What are the functions of Version Control?

Version control (or revision control, or source control) is all about managing multiple versions of documents, programs, web sites, etc.

  • A way to manage files and directories
  • Track changes over time
  • Recall previous versions

Why Version Control?1

  • For working by yourself:
    • Gives you a “time machine” for going back to earlier versions
    • Gives you great support for different versions (standalone, web app, etc.) of the same basic project
  • For working with others:
    • Greatly simplifies concurrent work, merging changes
  • For getting an internship or job:
    • Most companies use some kind of version control

Download and Install Git (Optional for E 115)

Note: You can just upload files to GitHub directly through the web browser. Using the GitBash or command line is not required for E 115. However, using Git/Git Bash may make things much quicker once you get it set up!

Introduce yourself to Git (Optional for E 115)

Once you’ve installed Git, you can use it through GitBash on Windows. It looks basically like the terminal (it functions pretty similarly to one, but doesn’t have quite everything working!). You can use the Terminal on a Mac/Linux machine

View of GitBash on Windows computer
View of git being used on a Mac terminal
View of git being installed on Ubuntu

Using your Repositories

Once you’ve set up an account at github.ncsu.edu, and have created the webpages repository as described in GitHub account preparation, you can clone the repository.

  • Get the files from your repository before starting.
    • Make a local repository as a clone of main
      • git clone <blah> (e.g., git clone https://github.ncsu.edu/unityID/webpages.git)
      • If you are having trouble, clone with ssh instead. But you may need to set up an SSH key. Follow these directions.
      • See all the contents of the folder
        • ls  -a to see the .git folder. 
  • Make changes
    • See what changed
      • git diff
    • Stage changes
      • git add –all (or particular files)
      • git  diff –cached
      • Still only in your repository

Updating the Repository

  • Put changes back up into repository
    • Commit your staged changes in your repository
      • git commit -m "the reason for the change"
    • Update the respository:
      • git push
  • At this point, you should be able to see the changes in the browser and your files should match what you did locally.

Typical Workflow

  • git pull
    • Get changes from a remote repository and merge them into your own repository
    • This is only after you’ve cloned the directory the first time.
  • git status
    • See what Git thinks is going on
    • Use this frequently!
  • Work on your files  
  • git add –-all (or just changes)
  • git commit –m “What I did
  • git push


  1. Much of the information on this page taken from CSC 116/CSC 216 resources. See powerpoint and webpage. Also powerpoint from University of Pennsylvania, edited. ↩︎