Skip to content

PThanushree/GitubSession

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributing to Open Source Projects using Git

Welcome to our project! We're excited that you're considering contributing to open-source development. This guide will walk you through the essential Git commands and best practices to make your contribution easy and successful.

Table of Contents

  1. Forking the Repository
  2. Cloning the Repository
  3. Creating a Branch
  4. Making Changes
  5. Committing Changes
  6. Pushing Changes
  7. Creating a Pull Request
  8. Syncing Your Fork
  9. Tips for Writing Good Commit Messages

1. Forking the Repository

Before you start contributing, you need to fork the repository. Forking creates a copy of the repository under your own GitHub account.

Steps:

  1. Navigate to the repository page.
  2. Click the "Fork" button at the top-right corner.
  3. You'll now have a copy of the repository in your GitHub account.

2. Cloning the Repository

After forking the repository, you need to clone it to your local machine so you can work on it.

git clone https://github.com/your-username/repository-name.git

3. Creating a Branch

After cloning the repository, create a new branch to work on your changes. Always work in a separate branch to avoid conflicts with the main branch:

git checkout -b feature/your-branch-name

4. Making Changes

Now that you're in your branch, make the necessary changes to the code, documentation, or other parts of the project. Be sure to test everything before moving on to the next step.


5. Committing Changes

Once your changes are complete, it's time to commit them. Follow these steps:

  1. Add the changes to the staging area:
git add .
  1. Commit the changes with a clear and descriptive message:
git commit -m "Your descriptive message here"
  1. Make sure your commit message clearly explains the changes you made.

6. Pushing Changes

After committing your changes locally, push the branch to your GitHub repository.

git push origin feature/your-branch-name

This will upload your branch to your forked repository on GitHub.

7. Creating a Pull Request

With your changes pushed to GitHub, you're ready to submit a pull request (PR) so the maintainers can review your work.

  • Navigate to your forked repository on GitHub.
  • Click the "Compare & pull request" button.
  • Provide a title and a detailed description of your changes.
  • Submit the pull request.
  • After reviewing, the maintainers will either merge your PR or provide feedback for revisions.

8. Syncing Your Fork

If the original repository is updated while you're working, you might want to sync your fork to keep it up-to-date. Here's how:

  1. Add the upstream repository as a remote:
git remote add upstream https://github.com/original-owner/repository-name.git
  1. Fetch the latest changes from the upstream repository:
git fetch upstream
  1. Merge the upstream changes into your local main branch:
git checkout main
git merge upstream/main
  1. Push the updated main branch to your fork:
git push origin main

9. Tips for Writing Good Commit Messages

  • Keep it concise: Aim for a commit message that's under 50 characters.
  • Use the imperative mood: For example, write "Fix bug" instead of "Fixed bug."
  • Provide context: Include the issue number or describe the purpose of the change.
    Example: Fix #42 - Resolve bug in user authentication.

About

Pro handson github session

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 100.0%