This project is maintained by mantejjosan
This tutorial will guide you through the complete process of forking a repository, cloning it to your local machine, creating a new branch, working on it, committing your changes, pushing those changes to your forked repository, and finally submitting a pull request (PR) to the original repository. All operations will be performed using git
and the GitHub CLI (gh
) from the terminal.
First, you need to fork the repository to your GitHub account. You can do this using the GitHub CLI (gh
).
gh repo fork <repository-ssh-link>
Replace <repository-ssh-link>
with the SSH link of the repository you want to fork.
After forking the repository, you can clone it to your local machine:
gh repo clone <your-forked-repo-ssh-link>
Replace <your-forked-repo-ssh-link>
with the SSH link of your forked repository.
*NOTE: As per our need for frappe we are asked to clone using
bench get-app git@github.com:GreatDevelopers/library_management_system.git
If you want to clone a specific branch, use:
git clone --branch <branch-name> <your-forked-repo-ssh-link>
Replace <branch-name>
with the name of the branch you want to clone.
To clone all branches of the repository:
git clone <your-forked-repo-ssh-link> --mirror
This command will clone the entire repository, including all branches.
If your repository is not already initialized with Git (which it typically would be), you can initialize it using:
git init
To create a new branch where you can work on your changes:
git checkout -b <new-branch-name>
Replace <new-branch-name>
with a meaningful name for your new branch.
Now, you can make changes to the files in your repository. Once you’ve made the desired changes:
To stage all the changes you’ve made:
git add .
After staging, commit your changes with a descriptive message:
git commit -m "Your commit message here"
Before pushing your changes, ensure that the remote repository points to your fork. You can do this by adding your fork’s URL as the origin
:
git remote add origin <your-forked-repo-ssh-link>
Replace <your-forked-repo-ssh-link>
with the SSH link of your forked repository.
Push your changes to the new branch in your forked repository:
git push origin <new-branch-name>
Replace <new-branch-name>
with the name of the branch you created earlier.
To submit your changes to the original repository as a pull request, use the GitHub CLI:
gh pr create --base <original-repo-branch> --head <your-forked-repo>:<new-branch-name> --title "PR Title" --body "Detailed description of your changes"
<original-repo-branch>
: The branch of the original repository you want to merge your changes into (e.g., main
).<your-forked-repo>
: Your GitHub username or the name of your forked repository.<new-branch-name>
: The branch where your changes are located.You can use gh
to view and manage your pull request:
gh pr view
gh pr status