Git Product home page Git Product logo

startinggithub's Introduction

StartingGithub

Steps

  1. Fork the repo
  2. Clone your repo
  3. Create a new branch
  4. Add and Commit changes
  5. Push Changes
  6. Submit Pull Request

Fork the repo

The first thing you need to do is create a copy of the repository under your personal account. Doing this is called "forking" the repository.

Fork the repo

Clone your repo

Once you have a copy of the repository under your personal account, you need to download the repository to your computer so that you can add changes. We call this "cloning" the repository.

We do this in two steps:

  1. First copy the link of the repo from the big green button saying "clone or download" in the top right corner like below

Get the repo clone link

  1. In your terminal, type in the following line in a directory you want your repo saved
git clone <link you copied>

After it is saved, you should see that a file with the name of the repo has been downloaded. If you want to follow along with this tutorial, type the following line into the terminal.

git clone https://github.com/sarvasvkulpati/StartingGithub.git

Create a new branch

When we add new features, we add them on a different branch. A branch allows you to experiment with changes to your repository without messing up your code. It does this by creating a copy of your code that you can add changes to.

  1. First, enter your repositories folder from the command line
cd StartingGithub
  1. Next, we create a branch
git checkout -b <branch name here>

Since you'll be adding your name, it would be a good idea to name your branch something descriptive, like "add-my-name"

git checkout -b add-my-name

Add and commit changes

Next, open the file you need to make changes to, and add your edits. If you're following along with this repo, open Contributors.md and add your name to the file.

After making your contributions, tyep the following command into your terminal

git status

You should see something like this git status

Now, we need to tell git that we want this file saved. To do this, we type the following command

git add Contributors.md

If you edit multiple files, you can also use the -A flag, which adds all files:

git add -A

Finally, we save the file. Saving the file to your local repository is called commiting your changes. When we commit changes, we usually also add a message, denoted by the -m flag, to explain what we changed.

git commit -m "added my name"

Push changes

Finally, you need to save your local changes to github's servers. Doing so is called pushing your code to a remote, in this case, the remote is Github. When you clone a repository from Github, your downloaded repo comes with the remotes pre-installed. You can check this by typing:

git remote -v

you'll see something like this git status

To push your code, type in the following

git push origin <branch-name>

If you're following the tutorial, this branch name would be add-my-name

Submit a pull request

As a last step, we need to add the changes from your copy of the repo to the main copy of the repo. To do this, you need to submit a request to the owner of the main repo, so they can check whether your changes are appropriate after which they can pull your changes into the main repo. This request is called a pull request

After pushing your changes to your personal repo, you should see a green button that appears above saying "compare and pull request. After clicking that, you can add a message, and then click create pull request.

pull request

startinggithub's People

Contributors

sarvasvkulpati avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.