-
Notifications
You must be signed in to change notification settings - Fork 1
Tutorial: Basics of Github
According to Wikipedia, Github is a "web based version control repository." In simple English, that means that Github is an online service that allows you to track and merge changes you and your teammates have made to your work. Github also allows you to do lots of other cool things, like host websites, make a Trello-like project board, and write documentation on your work.
Please note, Git is a distributed version control tool that can manage a development project's source code history, while GitHub is a cloud-based platform built around the Git tool. Git is a tool a developer installs locally on their computer, while GitHub is an online service that stores code pushed to it from computers running the Git tool. (theserverside.com)
Let’s start with the basics.
-
git clone: (Only use this command the first time you want to access a repository) Copies the specified repository to your computer.
-
git clone <insert repository URL here>
-
-
git pull: Updates your local copy of the repository, on your computer.
-
General command:
git pull
-
Pulling specific branch: ’git pull origin ’
-
-
git add: Adds <filename’s> contents to the index of files being pushed to Github.
- Command:
git add
- Command:
-
git commit: Stores all indexed files in a new commit, and tags them with a log message from the user, describing all changes.
-
Command:
git commit
-
-
git push: Updates all remote repositories based on the files that were commited
-
General command:
git push
-
Specific branch: `git push < remote_repository_name > < branch_name >
-
-
Git pull request: Lets the repository owner know that they should merge your changes with the master branch
-
How to make a pull request: https://help.github.com/articles/creating-a-pull-request/
-
-
git add <filename>
-
git commit –m “< insert commit message >”
-
git push origin <branchname>
-
git branch: Creates a new branch, or version of the code, by duplicating your current pushed version of the code. You can now work off of the code in the new branch and implement different functionality.
-
git stash: Saves your currently commited, but not pushed, files in a “stash,” where they can later be accessed if needed. “Git Stash Apply” reverses this process.
-
git stash < stash_name >
-
git stash apply < stash_name >
-
-
git status: Tells you what files are currently commited and will be pushed to Github.
git status
• Repository: The overarching location where code is stored for a project/etc.
• Remote repository: Versions of your repository hosted elsewhere on the internet. They enable you to collaborate and share work with others.
• Branch: The “folder” containing a particular version of your code. You can only work on one branch at a time.
• Master branch: The branch containing the “official” version of the code. You should only push working code to the master branch, so that this version of code is functional at all times.
• Merge conflict: An error that occurs when you edit the same file as someone else, then try to push your changes. Github isn’t sure which version is correct, so you must go back and manually determine which changes should be preserved.
• Markdown: A “coding language” specific to Github wikis and webpages. It uses specific syntax to encode graphics.
• < Stuff >: The convention for marking user-specific input. Insert whatever “Stuff” is here. Don’t leave the “<>” signs in when executing the command.
This page is complete. This tutorial was written by L. Zuehsow, on 2-25-17.