GitHub is a code hosting platform that is meant for version control and collaboration. GitHub allows the user and others to work in unison on any project. In nutshell, it is a social network that has transformed the vision of our work.
Emerging from developer’s collaborative platform, GitHub is now considered as one of the largest online storage space of collaborative works. GitHub essentials like repositories, branches, commits, and Pull Requests are few things that must be known to the user. Github’s Pull Request workflow is the most popular way to create and review code.
Go through the following steps to know what this version control system provides and how to use it.
Step 1 : Create a Repository
1. Tap on + option present next to avatar or identicon in the upper right corner.
2. Name your repository abc.
3. Select Initialize this repository with a README
4. Click Create repository.
Step 2 : Create a Branch
Branching is done in GitHub to work in several versions of a repository at a single time. Your repository already has one branch known as master by default. Branches are meant for experiment and making edits.
Steps to create a new branch
1. Land on recently made repository abc.
2. Press the Branch: master drop down at top left.
3. Type a branch name, readme-edits, into the new branch text box.
4. Select the blue Create branch box.
Step 3 : Make and commit changes
Commits are the changes done that are saved. Commit messages stores changes done in history.
1. Press the README.md file.
2. To edit the commits, press the pencil icon in the upper right corner.
3. In the editor, tell about you.
4. Scroll down and text a commit message that describes your alters.
5. Press Commit changes button.
Step 4 : Open a Pull Request
Pull request option is the one on which GitHub harps around. Pull request option proposes your alters so that someone may look into it and compile them into their branch. This option show diffs, or differences, of the content from both branches. Marked by green or red, pull request is accessible after you make a commit. Mention System in pull request also asks for feedback from specific people.
1. Click the Pull Request tab, then from the Pull Request page, click the green New pull request branch.
2. On the left side bar select the branch you want to compare, xyz for instance, to compare with master.
3. Reconsider the changes you made and clarify if they are same as you want them to be.
4. Press big green Create Pull Request button after you have clarified the changes.
5. When you’re done with your message, click Create pull request!
Step 5 : Merge your Pull Request
So finally you are very close to learn GitHub. You need to compile the alters done by merging xyz branch into the master branch.
1. Press the pull request option indicated by green to compile alters
2. Press Confirm merge.
3. Lastly delete the branch as the changes are compiled.