This tutorial is out of date and no longer maintained.
Note: This topic is also covered in How To Create a Pull Request on GitHub and How To Rebase and Update a Pull Request.
GitHub is an excellent resource for finding useful code. In order to contribute changes back to a project, you’ll need to make a local copy and then upload your changes. In this tutorial, you’ll fork and clone an existing repo, and then make changes to your local copy of the repo and push them back to GitHub.
Go to the Skeletonwebsite repository on GitHub and click on Fork.
Fork will create a copy of the repository in your GitHub account so that you can make changes to the project.
Go to your own GitHub repository and you will see a repository named skeletonwebsite.
Click into this repository and we will now make a local copy of it on your machine by hitting the clone button.
Copy the HTTPS URL.
Open your terminal or git bash window.
Move to the location on your computer where you want to create a copy of this project.
Run the following command:
Note: Substitute your GitHub username for userid.
You now have a local copy on your computer.
The folder on your computer will have the same name as the remote repository on GitHub, skeletonwebsite
Change to the project directory:
Initialize git:
After running git init
you should see a hidden git folder in your skeletonwebsite directory. If you don’t see it, change the settings on your computer to show hidden files and directories.
To see the current status of your local repository, run:
This will show if you have any commits that are staged or committed.
Open up the index.html
file in your code editor.
Add a heading or a paragraph.
Check the current status with changes applied:
You should see that there are changes not staged to be committed with the index.html
file in red.
We will now add this change by running:
If you want to add multiple files at once then you can run git add .
Run git status
:
Changes have now been staged and are ready to be committed.
Now we can run git commit
to commit these changes.
Use the -m
flag to add a commit message.
Remember to describe the specific change you made in the git commit message.
To check that everything is up to date, run:
This message shows everything is up to date.
We can now push our code to our repository on GitHub.
Before we do this, see what remote repository on GitHub our local repository is connected to:
To push our changes to this repository, run:
Check that your remote repository has been updated on GitHub.
In this tutorial, you have successfully:
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!