Github How to use

In this guide I will walk you how to use Github. You will see the requirements for using GitHub

Step 1: Install git

Windows

For Windows follow this Guide to Install Git on Windows

Mac OS

For Mac OS follow this Guide to Install Git on Mac OS

Step 2: Register a GitHub account

To be able to use GitHub you need to create an account you need to register an account. To do so go to github.com/join and fill out his form:

Github How to use Register


Step 3: Create a local git repository

Go in your terminal to the folder where you want to create a git repository. Create it by executing git init.

You will get a confirmation that looks like this: Initialized empty Git repository in $yourFolder

Github How to use Create git repository


Step 4: Add a new file to the repo

To add a file to the repository execute git add $filename
Github How to use Add a new file to the repo

Replace $filename with the name of the actual file you want to add to your repository

Step 5: Create a commit

To create a commit execute git commit -m $commitMessage
Github How to use Create a commit

Replace $commitMessage with a message that explains what you did here

Step 6: Create a new branch

To create a new branch execute git checkout -b $branchName

Github How to use Create a new branch

Replace $branchName with the name you want to give the branch your working on.

Step 7: Create a new repository on GitHub

Click on Create repository . The confirmation looks like this:

Github How to use New Repository Confirmation

Step 8: Push a branch to GitHub

To push the content of a branch execute git push -u origin $branchName

Github How to use Push a branch to GitHub

Replace $branchName with you wished branch

Step 9: Create a Pull Request (PR)

Navigate your web browser to github.com/$project/pulls and click on New pull request:

Github How to use New pull request

You will see a mask like this:

Github How to use New Pull Request repositories

Select your target repository in base (the left one) and your source repository in compare (right one).

Github How to use New Pull Request repositories 2

Click on Create pull request:

Github How to use Register Create a Pull Request first

You will see this mask:

Github How to use Register Create a Pull Request second

Click on “Create pull request” and you created the pull request.

Step 10: Merge a PR

To merge a PR you go to GitHub, the pull request you just created and scroll down until you see “Merge pull request”:

Github How to use Merge a PR


Step 11: Get changes on GitHub back to your computer

To get changes make sure you have checked out your branch by executing git checkout $branchName

Github How to use git checkout for pull

Replace $branchName by the branch you want

Then execute git pull

Github How to use git pull

Best,

Frank

Sources:

https://kbroman.org/github_tutorial/pages/init.html

https://www.atlassian.com/git/tutorials/install-git

Leave a Reply