[go: up one dir, main page]

0% found this document useful (0 votes)
25 views8 pages

Git Hub

The document provides a comprehensive guide to using GitHub, covering topics such as setting up Git, creating a GitHub account, and managing repositories. It outlines the GitHub Flow for collaborative development, including branching, committing changes, and creating pull requests. Additionally, it explains how to contribute to open-source projects and communicate effectively on the platform through issues and comments.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views8 pages

Git Hub

The document provides a comprehensive guide to using GitHub, covering topics such as setting up Git, creating a GitHub account, and managing repositories. It outlines the GitHub Flow for collaborative development, including branching, committing changes, and creating pull requests. Additionally, it explains how to contribute to open-source projects and communicate effectively on the platform through issues and comments.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

1.

Introduction to GitHub
GitHub is a platform that uses Git for version control and
enables collaboration among developers on code. It offers tools
to manage repositories, track changes, collaborate through pull
requests, and communicate with other contributors.
GitHub Website:
Visit the GitHub homepage at https://github.com/.

2. Set up Git
Step 1: Download Git
To use GitHub, you must first install Git on your local machine.
● Visit the official Git website: https://git-scm.com/.
● Download the appropriate version for your operating
system (Windows, macOS, or Linux).
Step 2: Install Git
● Follow the instructions provided by the installer. Use the
default settings for most options, unless you need specific
customizations.
Step 3: Configure Git
After installation, configure Git with your username and email
using the terminal or command prompt.
bash
Copy code
git config --global user.name "Your Name"
git config --global user.email "youremail@example.com"
These settings will associate your commits with your GitHub
profile.
Step 4: Verify Git Installation
Confirm that Git has been installed correctly by typing:
bash
Copy code
git --version
This should return the version of Git installed.

3. Create a GitHub Account


Step 1: Visit GitHub's Sign Up Page
Go to GitHub’s sign-up page: https://github.com/join.
● Fill in the required information: username, email, and
password.
● Choose whether you want a free or paid plan.
● Verify your email by clicking the confirmation link sent to
your inbox.
Step 2: Log into GitHub
After account creation, visit https://github.com/login.
● Enter your username or email and password.
● Click Sign in.

Now you are on your GitHub dashboard.

4. Create a Repository
A repository is the core unit of GitHub, where your project’s
code, documentation, and other files are stored.
Step 1: Create a New Repository
On your GitHub dashboard, click the + icon in the top-right
corner of the screen, and then select New repository or visit
https://github.com/new.
Step 2: Fill in Repository Details
● Repository name: Enter a name for your project.
● Description: Optionally add a brief description of the
project.
● Public/Private: Choose whether you want the repository to
be public or private.
● Optionally, check Initialize this repository with a
README.
● Click Create repository.

Now you have created a new repository and will be directed to


the repository page (e.g.,
https://github.com/your-username/repo-name).
Step 3: Clone the Repository to Your Local Machine
Copy the repository’s URL from the GitHub repository page.
1. Open a terminal/command prompt and navigate to the
folder where you want to clone the repository.
2. Use the following command:
bash
Copy code
git clone https://github.com/your-username/repo-name.git
This command will clone the repository to your local system.

5. GitHub Flow
GitHub Flow is a simple, branch-based workflow for developing
and collaborating on code.
Step 1: Create a Branch
You should create a separate branch for any new feature or bug
fix you want to work on. To create a new branch in your local
repository, run:
bash
Copy code
git checkout -b feature-branch
You will now be working on the feature-branch.
Step 2: Make Changes
Make any necessary changes to the files in the repository. After
editing, you will need to stage and commit the changes.
bash
Copy code
git add .
git commit -m "Your descriptive commit message"
Step 3: Push Your Changes to GitHub
Once you’ve committed your changes, push them to your
GitHub repository:
bash
Copy code
git push origin feature-branch
Step 4: Create a Pull Request
After pushing your branch to GitHub, navigate to the repository
page in your browser. GitHub will display a prompt to open a
pull request (PR).
● Click Compare & pull request.
● Provide a title and description for the pull request.
● Click Create pull request.

You’ve now initiated a PR, where your collaborators can review


and discuss the changes.
Step 5: Merge the Pull Request
Once your pull request is reviewed and approved, it’s time to
merge it into the main branch.
● Navigate to the pull request in GitHub.
● Click Merge pull request.
Finally, delete the branch if it’s no longer needed:
bash
Copy code
git branch -d feature-branch

6. Contributing to Open Source Projects


Contributing to projects on GitHub is a common way to
collaborate on open-source projects.
Step 1: Fork a Repository
To contribute to someone else’s repository, you need to create a
fork, which is a copy of the repository under your own GitHub
account.
1. Navigate to the repository you want to contribute to.
2. Click the Fork button in the upper-right corner.
3. This creates a copy of the repository in your account (e.g.,
https://github.com/your-username/repo-name).
Step 2: Clone the Forked Repository
Now, clone the forked repository to your local machine:
bash
Copy code
git clone https://github.com/your-username/repo-name.git
Step 3: Create a New Branch
To make your changes, create a new branch:
bash
Copy code
git checkout -b feature-branch
Step 4: Make Changes and Push
Make your changes locally, then commit and push them:
bash
Copy code
git add .
git commit -m "Description of changes"
git push origin feature-branch
Step 5: Create a Pull Request
Open a pull request from your fork to the original repository:
1. Go to your forked repository on GitHub.
2. Click Pull requests > New pull request.
3. Set the original repository as the base, and your branch as
the compare branch.
4. Submit the pull request for review.

7. Communicating on GitHub
Step 1: Opening an Issue
GitHub’s Issues feature is used for reporting bugs, proposing
enhancements, or discussing projects.
1. Go to the repository’s main page.
2. Click Issues > New issue.
3. Provide a title and detailed description.
4. Click Submit new issue.
Step 2: Commenting on Pull Requests or Issues
When collaborating, you can leave comments on open issues
and pull requests to provide feedback, discuss changes, or
suggest improvements.
1. Open an issue or pull request.
2. Scroll to the bottom and type your comment in the provided
text box.
3. Click Comment.

You might also like