0% found this document useful (0 votes)
20 views

Git Workflow

Collaborate On GitHub outlines the process for collaborating on an open source project hosted on GitHub. The steps include: 1) Forking the target repository to make a copy, 2) Cloning the forked repo locally and checking out a topic branch, 3) Making changes to the topic branch, 4) Pushing the topic branch to the forked repo, 5) Creating a pull request via the GitHub diff viewer for review, 6) Making any requested changes, and 7) Merging the pull request into the upstream master branch if approved.

Uploaded by

mansha99
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Git Workflow

Collaborate On GitHub outlines the process for collaborating on an open source project hosted on GitHub. The steps include: 1) Forking the target repository to make a copy, 2) Cloning the forked repo locally and checking out a topic branch, 3) Making changes to the topic branch, 4) Pushing the topic branch to the forked repo, 5) Creating a pull request via the GitHub diff viewer for review, 6) Making any requested changes, and 7) Merging the pull request into the upstream master branch if approved.

Uploaded by

mansha99
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Collaborate On GitHub

1.
2.
3.
4.
5.

Fork the target repo to your own account.


Clone the repo to your local machine.
Check out a new "topic branch" and make changes.
Push your topic branch to your fork.
Use the diff viewer on GitHub to create a pull request
via a discussion.
6. Make any requested changes.
7. The pull request is then merged (usually into the master
branch) and the topic branch is deleted from the
upstream (target) repo.

A fork is a copy of a repository.


Forking a repository allows you to freely
experiment with changes without affecting the
original project.
1. Fork the repository.
2. Make the fix.
3. Submit a pull request to the project owner.

git clone https://github.com/mansha99/Spoon-Knife.git

Adding the Upstream Remote


cd Spoon-Knife
git remote add upstream
https://github.com/mansha99/Spoon-Knife.git
This will now allow you to pull in changes from
the source locally and merge them, like so:
git fetch upstream
git merge upstream/master

Committing
Now, you can make your changes, and create a
commit that tracks just those changes.
git commit -am "adding a smileyface to the documentation."

Step 6: Pushing
Next, you'll push this topic branch to your own
fork of the project.
git push origin enhancment_345

Creating a Pull Request


Finally, you will create a pull request. First, go to
your fork of the repo. You might see a "your
recently pushed branches", and if so, you can
choose "Compare and Pull Request". Otherwise,
you can select your branch from the dropdown,
and subsequently click "Pull Request" or
"Compare" at the top right of the repo section.

You might also like