Skip to content

Instantly share code, notes, and snippets.

@wilfreddenton
Last active October 14, 2017 23:59
Show Gist options
  • Save wilfreddenton/81ed0686837ed99192e972839b1c16b4 to your computer and use it in GitHub Desktop.
Save wilfreddenton/81ed0686837ed99192e972839b1c16b4 to your computer and use it in GitHub Desktop.
A quickstart guide for github

1. Setup Git

When visiting the following Github articles make sure that you select the correct platform at the top to get the right tutorials.

First you should download and install git if you haven't already

Next set your github username in git

Then set your email in git. It's best to use the email associated with Github for this.

I find that the best way to connect with git is over the ssh protocol. This does not mean you will be sshing into Github it's just the protocol that git will use to communicate with Github. So let's get this setup.

Create a new ssh key

Finally add the ssh key to Github

2. Clone the Repo

All git commands should be run in Git Bash.

git clone [email protected]:wilfreddenton/mirana.git

3. Make a Branch

All git commands should be run in Git Bash.

Move into the project directory.

cd mirana

Create a new branch.

git checkout -b branchname

Replace branchname with something like username/feature like wilfred/unittests. The -b flag means "create branch". So you checkout a new branch called branchname. If you want to checkout a different branch like master which already exists then do git checkout master.

4. Push a Commit

First make some changes to the project in your branch.

Add changes to the commit.

git add -A

The -A flag means all changes: created files, deleted files, modified files.

Commit changes locally.

git commit -m "a description of the commit"

The -m flag is to add a message to the commit. Committing is like saving your progress in a video game.

Push the commit to Github.

First commit in a new branch: git push --set-upstream origin branchname

All other commits: git push

The reason why you have to do --set-upstream for the first commit in the branch is beacuse you need to tell Github (the origin) to create the branch branchname

5. Make a Pull Request

Visit the branches page.

Click "New pull request" for the branch you want to merge in.

Follow the on screen instructions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment