
When you fork a repository on GitHub, you create a copy of the original repository in your own GitHub account. This means you can freely experiment with the code, make changes, and contribute to the project. However, forking a repo is just the first step in the process. There are several important actions you should take after forking a repo to ensure that you can effectively work with the code, collaborate with others, and make your own contributions.
One of the first things you should do after forking a repo is to clone the forked repository to your local machine. This allows you to work with the code locally, make changes, and test them before pushing your changes to the GitHub repository. To clone the repository, you can use the “git clone” command followed by the URL of your forked repository. Once the repository is cloned, you can navigate to the local directory and start working with the code using your preferred text editor or Integrated Development Environment (IDE).
After cloning the forked repository, it’s important to create a new branch for your changes. Creating a branch allows you to isolate your changes from the main branch of the repository, making it easier to manage and collaborate with others. You can use the “git branch” command followed by the name of your new branch to create a new branch. You can then switch to the new branch using the “git checkout” command. It’s a good practice to give your branch a descriptive name that reflects the purpose of your changes.
Once you have made your changes to the code in your local branch, it’s time to push your changes to the forked repository on GitHub. You can do this using the “git push” command followed by the name of your branch. This will update the forked repository with your changes, making them available for others to see and review. After pushing your changes, you can create a pull request to suggest your changes to the original repository. A pull request is a way to propose changes and collaborate with the repository’s maintainers. It allows them to review your changes, provide feedback, and merge your changes into the main branch if they are deemed suitable.
Setting up your local environment
After forking a repository, the next step is to set up your local development environment. This will allow you to make changes to the code, experiment with new features, and test your changes before submitting them as a pull request.
Here are the steps to set up your local environment:
1. Clone the repository
To clone the repository to your local machine, open your terminal and navigate to the directory where you want to store the project. Then, run the following command:
git clone https://github.com/your-username/repo-name.git
Replace “your-username” with your GitHub username and “repo-name” with the name of the repository you have forked.
2. Install dependencies
Before you can run the project, you may need to install its dependencies. This is usually done using a package manager like npm or yarn. Navigate to the project’s directory in your terminal and run the following command:
npm install
or yarn install
This will download and install all the necessary libraries and dependencies for the project.
3. Configure the project
Some projects require additional configuration before they can be run locally. This could involve setting up environment variables, configuring a database, or specifying authentication credentials. Refer to the project’s documentation or README file for instructions on how to configure it.
4. Run the project
After you have cloned the repository and installed the dependencies, you are ready to run the project locally. Use the appropriate command provided by the project’s build system or package.json file. For example:
npm start
or yarn start

This will start the development server and the project will be accessible in your web browser at http://localhost:3000
or a different URL depending on the project.
Now that you have set up your local development environment, you can start making changes to the code, testing new features, and contributing to the project.
Note: Remember to regularly pull any changes made to the original repository to keep your local copy up to date. This can be done using the git pull
command.
Reviewing the codebase
After forking a repo, it’s important to thoroughly review the codebase before making any changes or contributions. This allows you to understand the existing code and architecture, identify any potential issues or bugs, and ensure compatibility with your own development environment.
Here are some steps to help you review the codebase:

1. Read the documentation
Start by reading any available documentation, such as the README file or the project’s wiki. This will give you an overview of the project’s goals, features, and any guidelines or conventions to follow.
2. Analyze the directory structure
Take a look at the directory structure to get an understanding of how the code is organized. This can give you insights into modules, components, and dependencies, helping you navigate the codebase more effectively.
3. Examine the code
Go through the code files and examine the code. Pay attention to code quality, coding conventions, and adherence to best practices. Look out for any code smells, redundant or duplicated code, or potential performance issues.
Consider running static code analysis tools, such as linters or code formatters, to identify any potential issues automatically.
4. Review the commit history
Take a look at the commit history to understand the evolution of the codebase. This can give you insights into the development process, any major changes or refactoring, and how active the project is.
5. Test the code
Set up a development environment and run the code to test its functionality. This can help you identify any bugs or inconsistencies, as well as understand how the code behaves in different scenarios.
If the project has an existing test suite, make sure to run the tests and see if they pass. This can give you confidence in the stability and reliability of the codebase.
By reviewing the codebase thoroughly, you can gain a solid understanding of the project and make informed decisions when making contributions or modifications.
Making changes and committing
After forking a repository, you may want to make changes to the code and contribute to the project. Here is a step-by-step guide on how to make changes and commit them to your forked repository:
- Clone the forked repository to your local machine using the command
git clone
. - Create a new branch for your changes using
git branch
command. - Switch to the new branch using
git checkout
. - Make the desired changes to the code using your preferred text editor or IDE.
- After making the changes, stage the modified files using
git add
command. You can specify individual files or usegit add .
to stage all changes. - Commit the changes using
git commit
command. Write a descriptive commit message that explains the changes you made. - Push the changes to your forked repository using
git push
command. - Finally, create a pull request on the original repository to propose your changes. This allows the repository owner to review and merge your changes if they deem them appropriate.
It is crucial to write clear and concise commit messages and to follow any guidelines provided by the project maintainers. This ensures that your changes can be easily understood and reviewed by others.
Creating a pull request
Once you have forked a repository and made changes to the code, you might want to contribute those changes back to the original repository. To do so, you need to create a pull request.
A pull request is a way to propose changes to a repository by submitting the modified code to the original project. This allows the repository’s maintainer to review and merge your changes into the main codebase if they are deemed suitable.
Here are the steps to create a pull request:
- Go to the original repository where you forked from.
- Click on the “Pull requests” tab.
- Click on the “New pull request” button.
- Select the branch from your forked repository that contains the changes you want to contribute.
- Provide a descriptive title and a clear description of the changes you made.
- Click on the “Create pull request” button to submit your request.
After creating the pull request, the repository’s maintainer will review your changes and provide feedback if necessary. It is important to keep an eye on the pull request to address any comments or concerns from the maintainer.
Once your changes are approved, they will be merged into the main codebase, and your contributions will become a part of the original project.
Creating a pull request is a great way to collaborate and contribute to open source projects. It allows you to share your improvements and contribute to the development of a project you find interesting or useful.