GitHub Repository Hosting Service

What is GitHub?

GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere.

GitHub essentials include repositories, branches, commits, and `pull’ requests.

Step 1: Install Git and create a GitHub account

Git Hub Account

Step 2: Create a Local git repository

$ git clone https://github.com/adhiyamaans/Reposit.git

Cloning into ‘Reposit’…

remote: Counting objects: 3, done.

remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0

Unpacking objects: 100% (3/3), done.

Clones  creates a repository into a newly created directory, creates remote-tracking branches for each branch in the cloned repository.

cd ~/MyProject

`CD’ stands for Change Directory, and it is also a navigational command. We just made a directory, and now we want to switch over to that directory and go inside it. Once we type this command, we are transported inside MyProject.

mkdir ~/MyProject:

$ mkdir AdhiRepo

mkdir is short for Make Directory. It’s not actually a Git command, but a general navigational command from the time before visual computer interfaces.

Step 3: Create a Branch

$ git branch

* master

Working with multiple collaborators and want to make changes on your own?

This command will let you build a new branch, or timeline of commits, of changes and file additions that are completely your own. Your title goes after the command.

If you wanted a new branch called “test_branch,” you’d type Git branch test_branch.

$ git branch test_branch

$ git branch

* master

test_branch

GIT CHECKOUT:

$ git checkout test_branch

Switched to branch ‘test_branch’

Literally allows you to “check out” a repository that you are not currently inside. This is a navigational command that lets you move to the repository you want to check.

You can use this command as Git checkout master to look at the master branch, or Git checkout cats to look at another branch.

$ git branch

master

* test_branch

Step 4: Check Modified and Newly Added Files

ADD Files:

touch Adhi.txt

touch means `create’. Whatever you write after that is the name of the thing created inside the folder.

GIT STATUS:

$ git status

On branch test_branch

Changes to be committed:

(use “git reset HEAD <file>…” to unstage)

new file:   AdhiRepo/Adhi.txt

Check the status of your repository.

See which files are inside it, what changes still need to be committed, and which branch of the repository you are currently working on.

GIT ADD:

$ git add *

This does not add new files to your repository. Instead, it brings new files to Git’s attention.

After you add files, they are included in Git’s `snapshots’ of the repository.

$ git status

On branch test_branch

Changes to be committed:

(use “git reset HEAD <file>…” to unstage)

new file:   AdhiRepo/Adhi.txt

Step 4. Merge and commit changes:

GIT MERGE:

When you’re done working on a branch, you can merge your changes back to the master branch, which is visible to all collaborators.

git merge cats would take all the changes you made to the “test_branch” branch and add them to the master.

GIT COMMIT:

$ git commit -a -m “new files added”

[test_branch 3390bc7] new files added

1 file changed, 0 insertions(+), 0 deletions(-)

create mode 100644 AdhiRepo/prabha.txt.

The above is Git’s most important command. After you make any sort of change, you input this in order to take a “snapshot” of the repository. Usually it goes Git commit -m “Message here.”

The -m indicates that the following section of the command should be read as a message.

Step 5. Merge your Pull Request

The Pull Request API allows you to list, view, edit, create, and even merge pull requests.

API Pull request

Use the base branch dropdown menu to select the branch you’d like to merge your changes into, then use the compare branch drop-down menu to choose the topic branch you made your changes in.Type a title and description for your pull request.Click Create pull request.

Step 6: Push a branch to GitHub

$ git push origin test_branch

Counting objects: 4, done.

Delta compression using up to 4 threads.

Compressing objects: 100% (2/2), done.

Writing objects: 100% (4/4), 324 bytes | 0 bytes/s, done.

Total 4 (delta 0), reused 0 (delta 0)

To https://github.com/adhiyamaans/Reposit.git

* [new branch]      test_branch -> test_branch.

If you’re working on your local computer, and want your Commits to be visible online on GitHub as well, you`push’ the changes up to GitHub with this command.

Git Hub

Reference

https://guides.github.com/activities/hello-world/

Author

  • Adhiyamaan Shanmugam

    Adhiyamaan works as Software Engineer with Trigent Software. With over 4 years' experience, Adhiyamaan has worked extensively on software projects with a focus on UI development and implementation. His areas of expertise include HTML/HTML5, CSS/CSS3, JAVASCRIPT, JQUERY and BOOTSTRAP.