GitHub
GitHub is a web-based Git or Version Control Repository and Internet hosting service. It is mostly used for code. It offers all of the distributed version control and source code management (SCM) functionality of Git as well as adding its own features. It provides access control and several collaboration features such as bug tracking, feature requests, task management, and wikis for every project.
GitHub offers both plans for private and free repositories on the same account which are commonly used to host open-source software projects. As of April 2017, GitHub reports having almost 20 million users and 57 million repositories, making it the largest host of source code in the world.
GitHub has a mascot called Octocat, a cat with five tentacles and a human-like face.
Introduction
Since the information on GutHub is huge, the documentation is enorm and the issues large it is not always easy to find what you are looking for on the GitHub Website. Therefore this (hopeful) help webpage.
GitHub Access
- GitHub Developer Authentication, Deprecating UID/PWD.
- Github with OAuth Access, Access token access using OAuth.
Git Very Easy
Create & Clone | ||
What | How | Explanation |
---|---|---|
Creates a new repo | git init | Creates a new local repository |
Clones a local repo | git clone /path-to-local-repo | Clones a local local repository to a new local location (the current location). |
Clones a remote repo | git clone username@host:/path/to/repo | Clones a remote repository to a local repository. |
Add & Remove | ||
What | How | Explanation |
Adds changes to the INDEX | git add <filename> | Adds a new file to the local repository. |
Adds all changes to the INDEX | git add * | Adds all new files to the local repository. |
Removes a file from INDEX | git rm <filename> | Removes / Deletes a given filename from the local repository |
Commit & Synchonize | ||
What | How | Explanation |
Commits changes | git commit -m "<Message>" | Commits changes from local to stage. |
Pushes changes to remote repo | git push origin master | Pushes the committed changes into the remote repositories master |
Connects local repo to remote | git remote add origin <server> | Connects the local repository to the remote repository. |
Updates the local repo with remote changes | git pull | Updates local repo, Pulls changes from the remote to the local repo. |
Branches | ||
What | How | Explanation |
Creates new branch | git checkout -b <new-branch> | Creates a new branch named new-branch. |
Switches to master branch | git checkout master | Switches to the branch master, which is the main line. |
Deletes a branch | git branch -d <branch-name> | Deletes the branch name from the repo. |
Pushes a branch to remote repo | git push origin <branch> | Pushes the current workspace branch into the remote. |
Merging | ||
What | How | Explanation |
Merges changes from another branch | git merge <branch> | Merges changes from another branch into the current local repo. |
Views the changes between 2 branches | git diff <source-branche> <target-branch> | Shows the differences between 2 different branches. |
Tagging | ||
What | How | Explanation |
Creates a tag | git <tag-name> <commit-ID> | Creates a tag for the given commit-id (See below) |
Gets the commit-ID | git log | Gets the commit-ID from the latest commits (Latest first). |
Restore | ||
What | How | Explanation |
Replaces working copy with latest from HEAD | git checkout --<filename> | Replaces the current working copy file with the latest from HEAD. |
Github flow
At GitHub, we use our products every day and have developed a workflow to collaborate on projects. To make it work for teams regardless of their size or technical expertise, we made sure each step in our workflow can be completed within a web-based interface. [1][2]
- Create a branch from the repository, Delete a branch from the repository. [3]
- Create, edit, rename, move, or [[#Delete file|delete] files.
- Send a pull request from your branch with your proposed changes to kick off a discussion.
- Make changes on your branch as needed. Your pull request will update automatically.
- Merge the pull request once the branch is ready to be merged.
- Tidy up your branches using the delete button in the pull request or on the branches page.
Create a branch
- On GitHub, navigate to the main page of the repository.
- Click the branch selector menu.
- Type a unique name for your new branch.
- Press Enter.
Delete a branch
- On GitHub, navigate to the main page of the repository.
- Above the list of files, click NUMBER branches.
- Scroll to the branch that you want to delete, then click the trash-bin.
Create, edit, rename, move, or delete
Create file |
Edit file |
Rename file |
Move file |
Delete file |
|
|
|
|
|
Send a pull request
See https://help.github.com/articles/about-pull-requests
Make changes
Just do the necessary changes.
Merge
See https://help.github.com/articles/merging-a-pull-request
Tidy up
See https://help.github.com/articles/deleting-and-restoring-branches-in-a-pull-request
GitHub Repo Files
GitHub encourages the creation of a number of standard files when adding a project or repository into the VCS. In every sense it is a good practise to do so.
Al files have the extension .md and uses the GitHub Wiki Markup Language MarkDown. Markdown is a way to style text on the web. You control the display of the document; formatting words as bold or italic, adding images, and creating lists are just a few of the things we can do with Markdown. Mostly, Markdown is just regular text with a few non-alphabetic characters thrown in, like # or *.
Markdown Syntax
The MarkDown syntax is explained on https://guides.github.com/features/mastering-markdown.
Text
- '*italic*' , italic by using 1 asterisk
- '**bold**', bold by using 2 asterisks
- [link to Google!](http://google.com) Link to Google
GitHub uses its own version of MarkDown named GitHub Flavored MarkDown (GFM), see https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown for more.
Changelog.md
The Changelog.md
Contributing.md
License
Readme.md
READMEs generally follow one format in order to immediately orient developers to the most important aspects of your project [4].
- Project name: Your project’s name is the first thing people will see upon scrolling down to your README, and is included upon creation of your README file.
- Description: A description of your project follows. A good description is clear, short, and to the point. Describe the importance of your project, and what it does.
- Table of Contents: Optionally, include a table of contents in order to allow other people to quickly navigate especially long or detailed READMEs.
- Installation: Installation is the next section in an effective README. Tell other users how to install your project locally. Optionally, include a gif to make the process even more clear for other people.
- Usage: The next section is usage, in which you instruct other people on how to use your project after they’ve installed it. This would also be a good place to include screenshots of your project in action.
- Contributing: Larger projects often have sections on contributing to their project, in which contribution instructions are outlined. Sometimes, this is a separate file. If you have specific contribution preferences, explain them so that other developers know how to best contribute to your work. To learn more about how to help others contribute, check out the guide for (setting guidelines for repository contributors)[1].
- Credits: Include a section for credits in order to highlight and link to the authors of your project.
- License: Finally, include a section for the license of your project. For more information on choosing a license, check out GitHub’s licensing guide!
See also
- Git, A VCS Language used on GitHub.
- GitHub is the best place to share code with friends, co-workers, classmates, and complete strangers. Over eight million people use GitHub to build amazing things together.
- Guides GitHub, Basic Information (Guides) to Git and the implementation of Git on GitHub.
- Help GitHub, The best place to look with a massive number of categories and help. A must if you are looking for something.
Reference
- ↑ Help-GitHub Articles, Help-GitHub-Flow
- ↑ Guides-GitHub Flow Guides
- ↑ Help-GitHub Categories, Managing Files.
- ↑ Open Source Guide, Making readmes readable.