Git Commands for Open-Source Contribution

Git Commands for Open-Source Contribution

Quick reference of git commands during contribution

ยท

2 min read

The step-by-step guide to contributing to open-source projects:

  1. Fork Repository: Top-right corner second button is a Fork.

  2. Clone Repository: Copy the URL of the repo to clone in your local directory. Open Git Bash, select the directory where you want to clone your repo, right-click and open Git Bash.

    git clone paste-your-URL

  3. Create a new branch:

    Change to the repository directory using:

    cd your-repo-name

    Create a branch using git switch or git checkout command:

    git switch -c your-new-branch-name

    or

    git checkout -b your-new-branch-name

  4. Make your changes (here you can find issues or improve code or add your name to the contribution list).

  5. Add those changes to the branch using the git add command.

    To add all changed files use:

    git add .

    Add specific changed file use:

    git add changed-file-name

  6. Commit those changes using git commit command:

    git commit -m "Add your message here"

  7. Push your changes to GitHub using git push command:

    git push -u origin your-branch-name

  8. Go to your repository on your GitHub, you'll click Compare & pull request button to add your PR.

  9. Finally, add your PR title and comment, then you'll click Create pull request button to complete your first pull request (PR).

Congratulations ๐ŸŽ‰ you have completed your first contribution.

List of some beginner's Open-Source Contribution Repository:

ย